Skip to main content

CellStore

Struct CellStore 

Source
pub struct CellStore { /* private fields */ }

Implementations§

Source§

impl CellStore

Source

pub fn new() -> Self

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, c: CellRef) -> Option<&Cell>

Source

pub fn get_mut(&mut self, c: CellRef) -> Option<&mut Cell>

Mutable access (copies the band if shared).

Source

pub fn set(&mut self, c: CellRef, cell: Cell)

Stores a cell; a default (empty, unstyled) cell is removed instead.

Source

pub fn rebuild(&mut self) -> usize

Puts every cell in the band its row says and recounts the length — serialized band keys and the cached count are derived state, and the ones a file carries are not trusted. Cells outside the sheet grid are dropped; returns how many (#1008).

Source

pub fn remove(&mut self, c: CellRef) -> Option<Cell>

Source

pub fn iter_range( &self, r: RangeRef, ) -> impl Iterator<Item = (CellRef, &Cell)> + '_

Cells in r, row-major. Efficient for sparse data: skips empty bands and rows.

Source

pub fn iter(&self) -> impl Iterator<Item = (CellRef, &Cell)> + '_

Source

pub fn row( &self, row: u32, c0: u32, c1: u32, ) -> impl Iterator<Item = (u32, &Cell)> + '_

Cells of one row in c0..=c1.

Source

pub fn used_range(&self) -> Option<RangeRef>

Smallest range containing every stored cell, None when empty.

Source

pub fn has(&self, c: CellRef) -> bool

Last stored row in column col at or above below_or_at (for Ctrl+arrow navigation).

Source

pub fn contiguous_value_run(&self, from: CellRef, cap: u32) -> Option<u32>

Last row (inclusive, capped at cap) of the maximal run of contiguous rows at or after from.row that store a cell in from.col with a non-empty value in from.col. None when from itself doesn’t qualify.

Deliberately narrower than has/get (which also count a formula with no cached value yet, for Ctrl+arrow navigation): this matches Sheet::value_ref, whose callers test the Value it returns with !v.is_empty() regardless of whether a formula produced it — a formula cell with an empty cached value (="", or not yet recalculated) is “empty” to them. A stored cell with no value and no formula (for example a formatted spill child) does fall through to spill in value_ref, so last_contiguous_nonempty asks value_ref about the row where this run stops.

Walks each band’s row map with BTreeMap::range (one in-order pass per band) instead of one get per row, so a long, densely-populated run costs roughly one tree-traversal step per row rather than one binary search per row.

Source

pub fn diff(&self, other: &CellStore) -> Vec<CellRef>

Positions whose cells differ between self and other (stored on one side only, or not equal). Bands both stores share are skipped, so comparing an edited copy with the store it was cloned from only visits the bands the edit touched.

Source

pub fn retained_bytes_against(&self, newer: &CellStore) -> usize

Approximate heap storage kept alive by this snapshot’s bands that newer no longer shares. This is for bounding Undo history, not for reporting process memory: BTreeMap nodes and allocator overhead vary by platform. Shared formulas and values are counted only when the newer band no longer holds the same Arc.

Source

pub fn take_range(&mut self, r: RangeRef) -> Vec<(CellRef, Cell)>

Removes every cell in r and returns them.

Source

pub fn shift_rows(&mut self, from: u32, delta: i64)

Rows strictly greater than or equal to from moved by delta (positive = down). Rows that would land before from… callers delete the vacated block first.

Source

pub fn shift_cols(&mut self, from: u32, delta: i64)

Source

pub fn shift_cols_in_rows(&mut self, r0: u32, r1: u32, from: u32, delta: i64)

Shifts cells within rows r0..=r1 and columns >= from horizontally (Insert/Delete Cells with shift right/left).

Source

pub fn shift_rows_in_cols(&mut self, c0: u32, c1: u32, from: u32, delta: i64)

Shifts cells within columns c0..=c1 and rows >= from vertically.

Trait Implementations§

Source§

impl Clone for CellStore

Source§

fn clone(&self) -> CellStore

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 CellStore

Source§

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

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

impl Default for CellStore

Source§

fn default() -> CellStore

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

impl<'de> Deserialize<'de> for CellStore

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CellStore

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for CellStore

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CellStore

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.