mirror of
https://github.com/msfjarvis/text-editor.git
synced 2024-06-03 04:18:57 +05:30
feat(document): plumb in an optional file name
This commit is contained in:
parent
15c874a2e3
commit
5ea82d6a71
|
@ -4,6 +4,7 @@ use std::fs;
|
|||
#[derive(Default)]
|
||||
pub struct Document {
|
||||
rows: Vec<Row>,
|
||||
pub file_name: Option<String>,
|
||||
}
|
||||
|
||||
impl Document {
|
||||
|
@ -25,6 +26,9 @@ impl Document {
|
|||
for line in contents.lines() {
|
||||
rows.push(Row::from(line));
|
||||
}
|
||||
Ok(Self { rows })
|
||||
Ok(Self {
|
||||
rows,
|
||||
file_name: Some(filename.to_string()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user