hecto/src/document.rs

22 lines
399 B
Rust

use crate::Row;
#[derive(Default)]
pub struct Document {
rows: Vec<Row>,
}
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()
}
}