diff --git a/src/storage/file/mod.rs b/src/storage/file/mod.rs index 21d5e92e..165c0276 100644 --- a/src/storage/file/mod.rs +++ b/src/storage/file/mod.rs @@ -32,20 +32,20 @@ pub struct File<'a> { impl<'a> File<'a> { - pub fn header(&self) -> FileHeaderData { - self.header.clone() + pub fn header(&self) -> &FileHeaderData { + &self.header } - pub fn data(&self) -> String { - self.data.clone() + pub fn data(&self) -> &String { + &self.data } - pub fn contents(&self) -> (FileHeaderData, String) { + pub fn contents(&self) -> (&FileHeaderData, &String) { (self.header(), self.data()) } - pub fn id(&self) -> FileID { - self.id.clone() + pub fn id(&self) -> &FileID { + &self.id } pub fn owner(&self) -> &'a Module<'a> { diff --git a/src/ui/file.rs b/src/ui/file.rs index 625eb43e..85168421 100644 --- a/src/ui/file.rs +++ b/src/ui/file.rs @@ -105,7 +105,7 @@ impl FilePrinter for TablePrinter { let cell_i = Cell::new(&format!("{}", i)[..]); let cell_o = Cell::new(&format!("{}", file.owner().name())[..]); - let id : String = file.id().into(); + let id : String = file.id().clone().into(); let cell_id = Cell::new(&id[..]); let row = Row::new(vec![cell_i, cell_o, cell_id]); tab.add_row(row);