pub struct Sheet { /* private fields */ }Expand description
One worksheet’s cells: sparse, row-major-ordered, unbounded up to the
u32 × u32 coordinate space.
Implementations§
Source§impl Sheet
impl Sheet
Sourcepub fn set(&mut self, row: u32, col: u32, cell: Cell)
pub fn set(&mut self, row: u32, col: u32, cell: Cell)
Sets (inserts or overwrites) the cell at row, col.
Sourcepub fn get(&self, row: u32, col: u32) -> Option<&Cell>
pub fn get(&self, row: u32, col: u32) -> Option<&Cell>
Returns the cell at row, col, or None when the coordinate is
blank (absent).
Sourcepub fn remove(&mut self, row: u32, col: u32)
pub fn remove(&mut self, row: u32, col: u32)
Removes the cell at row, col (making it blank). Removing an
absent coordinate is a no-op.
Sourcepub fn used_range(&self) -> Option<((u32, u32), (u32, u32))>
pub fn used_range(&self) -> Option<((u32, u32), (u32, u32))>
The used range — ((min_row, min_col), (max_row, max_col)) over all
present cells — or None when the sheet is empty. The spreadsheet
equivalent of the dimension element: the bounding box of occupied
coordinates.
Sourcepub fn iter(&self) -> Iter<'_, (u32, u32), Cell> ⓘ
pub fn iter(&self) -> Iter<'_, (u32, u32), Cell> ⓘ
Iterates present cells in row-major (deterministic) order.
Sourcepub fn cells_in(
&self,
rows: RangeInclusive<u32>,
cols: RangeInclusive<u32>,
) -> Vec<((u32, u32), &Cell)>
pub fn cells_in( &self, rows: RangeInclusive<u32>, cols: RangeInclusive<u32>, ) -> Vec<((u32, u32), &Cell)>
Collects the present cells in the given (row, col) range, in row-major order. Range-bounded scans back the file formats’ row streaming without materializing blank coordinates.
Trait Implementations§
Source§impl<'a> IntoIterator for &'a Sheet
impl<'a> IntoIterator for &'a Sheet
Source§fn into_iter(self) -> Self::IntoIter
fn into_iter(self) -> Self::IntoIter
Iterates present cells in row-major (deterministic) order — same as
Sheet::iter, so for (coord, cell) in &sheet works.