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

Fields

§from: Column

A range between two columns

  • from - Where the range begins
  • to - 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

Fields

§from: Address

A range between two positions

  • from - Where the range begins
  • to - Where the range ends
§

RowRange

Fields

§from: Row
§to: Row

A range between two rows

  • from - Where the range begins
  • to - Where the range ends

Implementations§

source§

impl RangeOrCell

source

pub fn iter(&self) -> RangeOrCellIterator

source§

impl RangeOrCell

source

pub fn column<C: Into<Column>>(x: C) -> Self

Create a RangeOrCell::ColumnRange at the given x index

source

pub fn column_range<C: Into<Column>>(xa: C, xb: C) -> Self

Create a RangeOrCell::ColumnRange between two columns.

source

pub fn range<A: Into<Address>>(aa: A, ab: A) -> Self

Create a RangeOrCell::Range between two addresses.

source

pub fn row<R: Into<Row>>(y: R) -> Self

Create a RangeOrCell::RowRange at the given y index

source

pub fn row_range<R: Into<Row>>(ya: R, yb: R) -> Self

Create a RangeOrCell::RowRange between two rows.

source

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.

source

pub fn shift_down(self, rows: usize) -> Self

source

pub fn shift_left(self, columns: usize) -> Self

source

pub fn shift_right(self, columns: usize) -> Self

source

pub fn shift_up(self, rows: usize) -> Self

source

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

source

pub fn with_y(&self, y: usize) -> Self

Trait Implementations§

source§

impl Clone for RangeOrCell

source§

fn clone(&self) -> RangeOrCell

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for RangeOrCell

source§

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

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

impl Display for RangeOrCell

source§

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

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

impl FromStr for RangeOrCell

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(a1: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
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

source§

fn into(self) -> A1

Converts this type into the (usually inferred) input type.
source§

impl Into<RangeOrCell> for Address

source§

fn into(self) -> RangeOrCell

Converts this type into the (usually inferred) input type.
source§

impl Into<RangeOrCell> for Column

source§

fn into(self) -> RangeOrCell

Converts this type into the (usually inferred) input type.
source§

impl Into<RangeOrCell> for Row

source§

fn into(self) -> RangeOrCell

Converts this type into the (usually inferred) input type.
source§

impl IntoIterator for RangeOrCell

§

type Item = RangeOrCell

The type of the elements being iterated over.
§

type IntoIter = RangeOrCellIntoIterator

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

fn into_iter(self) -> RangeOrCellIntoIterator

Creates an iterator from a value. Read more
source§

impl PartialEq for RangeOrCell

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for RangeOrCell

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> 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,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.