Skip to main content

Sheet

Struct Sheet 

Source
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

Source

pub const fn new() -> Self

An empty sheet.

Source

pub fn set(&mut self, row: u32, col: u32, cell: Cell)

Sets (inserts or overwrites) the cell at row, col.

Source

pub fn get(&self, row: u32, col: u32) -> Option<&Cell>

Returns the cell at row, col, or None when the coordinate is blank (absent).

Source

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.

Source

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.

Source

pub fn iter(&self) -> Iter<'_, (u32, u32), Cell> ⓘ

Iterates present cells in row-major (deterministic) order.

Source

pub fn len(&self) -> usize

Number of present (non-blank-by-absence) cells.

Source

pub fn is_empty(&self) -> bool

true when no cell is present.

Source

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 Clone for Sheet

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Sheet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Sheet

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> IntoIterator for &'a Sheet

Source§

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.

Source§

type Item = ((u32, u32), &'a Cell)

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn Iterator<Item = ((u32, u32), &'a Cell)> + 'a>

Which kind of iterator are we turning this into?
Source§

impl PartialEq for Sheet

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Sheet

Auto Trait Implementations§

§

impl Freeze for Sheet

§

impl RefUnwindSafe for Sheet

§

impl Send for Sheet

§

impl Sync for Sheet

§

impl Unpin for Sheet

§

impl UnsafeUnpin for Sheet

§

impl UnwindSafe for Sheet

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.