hecto/src/document.rs

22 lines
399 B
Rust
Raw Normal View History

2021-03-08 10:21:06 -05:00
use crate::Row;
#[derive(Default)]
pub struct Document {
rows: Vec<Row>,
2021-03-08 10:43:40 -05:00
}
impl Document {
pub fn open() -> Self {
let mut rows = Vec::new();
rows.push(Row::from("Hello, World!"));
Self { rows }
}
pub fn row(&self, index: usize) -> Option<&Row> {
self.rows.get(index)
}
pub fn is_empty(&self) -> bool {
self.rows.is_empty()
}
2021-03-08 10:21:06 -05:00
}