Enum a1_notation::RangeOrCell
source · 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
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
source§impl Into<RangeOrCell> for Address
impl Into<RangeOrCell> for Address
source§fn into(self) -> RangeOrCell
fn into(self) -> RangeOrCell
source§impl Into<RangeOrCell> for Column
impl Into<RangeOrCell> for Column
source§fn into(self) -> RangeOrCell
fn into(self) -> RangeOrCell
source§impl Into<RangeOrCell> for Row
impl Into<RangeOrCell> for Row
source§fn into(self) -> RangeOrCell
fn into(self) -> RangeOrCell
source§impl IntoIterator for RangeOrCell
impl IntoIterator for RangeOrCell
source§impl PartialEq for RangeOrCell
impl PartialEq for RangeOrCell
source§fn eq(&self, other: &RangeOrCell) -> bool
fn eq(&self, other: &RangeOrCell) -> bool
self
and other
values to be equal, and is used
by ==
.