Skip to main content

SheetData

Struct SheetData 

Source
pub struct SheetData { /* private fields */ }
Expand description

The cells of a worksheet, by row and column. Both are 1-indexed.

A row can exist without cells: set_row with no cells creates one. The xlsx importer does that for rows that carry a height or a style and nothing else, and the exporter writes a <row> element for every row that exists here, so such rows survive a round trip. Removing the last cell of a row with remove_cell removes the row.

Rows outside the sheet, below 1 or beyond the last row, cannot hold cells: writing to them does nothing and reading them finds nothing.

Implementations§

Source§

impl SheetData

Source

pub fn new() -> Self

Source

pub fn cell(&self, row: i32, column: i32) -> Option<Cow<'_, Cell>>

The cell at a position, if there is one.

Source

pub fn cell_mut(&mut self, row: i32, column: i32) -> Option<&mut Cell>

The cell at a position, to be changed in place.

Source

pub fn set_cell(&mut self, row: i32, column: i32, cell: Cell) -> Option<Cell>

Puts a cell at a position and returns the one that was there.

Source

pub fn remove_cell(&mut self, row: i32, column: i32) -> Option<Cell>

Removes the cell at a position and returns it.

Source

pub fn is_empty(&self) -> bool

True if the sheet has no rows.

Source

pub fn cells(&self) -> impl Iterator<Item = (i32, i32, Cow<'_, Cell>)>

Every cell of the sheet with its row and column, in natural order: by row, and within a row by column.

Source

pub fn rows(&self) -> Vec<i32>

The rows that exist, in ascending order.

Source

pub fn columns_in_row(&self, row: i32) -> Vec<i32>

The columns of a row that have cells, in ascending order.

Source

pub fn cells_in_row(&self, row: i32) -> Vec<(i32, Cow<'_, Cell>)>

The cells of a row with their column, in ascending order of column.

Source

pub fn cells_in_row_between( &self, row: i32, first_column: i32, last_column: i32, ) -> impl Iterator<Item = (i32, Cow<'_, Cell>)>

The cells of a row from first_column to last_column, both included, with their column, in ascending order of column. Reading a stretch of a row this way finds the row once, not once per cell.

Source

pub fn numbers_in_row_between( &self, row: i32, first_column: i32, last_column: i32, ) -> Option<&[f64]>

The numbers of a row from first_column to last_column, both included, if the row holds them as numbers and nothing else, with none missing. None is no news about the row: its cells say what it holds.

Source

pub fn remove_row(&mut self, row: i32)

Removes every cell of a row, and the row.

Source

pub fn set_row( &mut self, row: i32, cells: impl IntoIterator<Item = (i32, Cell)>, )

Replaces the cells of a row. The row exists afterwards, even with no cells. If a column is given twice the last one stays.

Trait Implementations§

Source§

impl Clone for SheetData

Source§

fn clone(&self) -> SheetData

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 SheetData

Source§

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

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

impl<'__de> Decode<'__de> for SheetData
where '__de:,

Source§

impl Default for SheetData

Source§

fn default() -> SheetData

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

impl Encode for SheetData

Source§

impl PartialEq for SheetData

Two sheets are equal when they have the same rows and the same cells. Which chunks happen to be allocated is not part of that.

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

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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
§

impl<T> DecodeOwned for T
where T: for<'de> Decode<'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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V