pub enum RangeOrCell {
Cell(Address),
ColumnRange {
from: Column,
to: Column,
},
NonContiguous(Vec<Self>),
Range {
from: Address,
to: Address,
},
RowRange {
from: Row,
to: Row,
},
}Variants§
Cell(Address)
Just a single cell
ColumnRange
A range between two columns
from- Where the range beginsto- Where the range ends
NonContiguous(Vec<Self>)
A set of cells and ranges
Note: rkyv requires that we add the omit_bounds for anything self-referential.
Range
A range between two positions
from- Where the range beginsto- Where the range ends
RowRange
A range between two rows
from- Where the range beginsto- Where the range ends
Implementations§
Source§impl RangeOrCell
impl RangeOrCell
Source§impl RangeOrCell
impl RangeOrCell
Sourcepub fn column<C: Into<Column>>(x: C) -> Self
pub fn column<C: Into<Column>>(x: C) -> Self
Create a RangeOrCell::ColumnRange at the given x index
Sourcepub fn column_range<C: Into<Column>>(xa: C, xb: C) -> Self
pub fn column_range<C: Into<Column>>(xa: C, xb: C) -> Self
Create a RangeOrCell::ColumnRange between two columns.
Sourcepub fn range<A: Into<Address>>(aa: A, ab: A) -> Self
pub fn range<A: Into<Address>>(aa: A, ab: A) -> Self
Create a RangeOrCell::Range between two addresses.
Sourcepub fn row_range<R: Into<Row>>(ya: R, yb: R) -> Self
pub fn row_range<R: Into<Row>>(ya: R, yb: R) -> Self
Create a RangeOrCell::RowRange between two rows.
Sourcepub fn contains(&self, other: &Self) -> bool
pub fn contains(&self, other: &Self) -> bool
This function has a lot going on because we need to handle every combination of every
RangeOrCell containing every other combination of a RangeOrCell. The rules are
nuanced but I think intuitive if you think through how it would look on a grid.
pub fn shift_down(self, rows: usize) -> Self
pub fn shift_left(self, columns: usize) -> Self
pub fn shift_right(self, columns: usize) -> Self
pub fn shift_up(self, rows: usize) -> Self
Sourcepub fn with_x(self, x: Index) -> Self
pub fn with_x(self, x: Index) -> Self
Set the x component of the underlying RangeOrCell. Depending on the variant of the
enum the rules will be different
pub fn with_y(&self, y: usize) -> Self
Trait Implementations§
Source§impl Clone for RangeOrCell
impl Clone for RangeOrCell
Source§fn clone(&self) -> RangeOrCell
fn clone(&self) -> RangeOrCell
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RangeOrCell
impl Debug for RangeOrCell
Source§impl Display for RangeOrCell
impl Display for RangeOrCell
Source§impl FromStr for RangeOrCell
impl FromStr for RangeOrCell
Source§impl Into<A1> for RangeOrCell
We allow converting from a more specific type (RangeOrCell) to a more general one (A1) but
it can’t happen the other way around, so therefore we need to implement Into rather than
From
impl Into<A1> for RangeOrCell
We allow converting from a more specific type (RangeOrCell) to a more general one (A1) but
it can’t happen the other way around, so therefore we need to implement Into rather than
From