pub struct CellRange {
pub start_row: usize,
pub start_col: usize,
pub end_row: usize,
pub end_col: usize,
/* private fields */
}Expand description
A rectangular selection, always stored normalized: start is the top-left
(row-major minimum) and end the bottom-right, whichever corner the user
dragged from.
Fields§
§start_row: usize§start_col: usize§end_row: usize§end_col: usizeImplementations§
Source§impl CellRange
impl CellRange
Sourcepub fn from_corners(a: CellRef, b: CellRef) -> Self
pub fn from_corners(a: CellRef, b: CellRef) -> Self
Normalizes a possibly-inverted drag.
Inversion is the normal case, not an error: dragging up-and-left from the anchor produces an inverted range by definition. Normalizing here means every downstream consumer can assume ordering.
pub fn single(cell: CellRef) -> Self
pub fn contains(&self, cell: CellRef) -> bool
pub fn row_count(&self) -> usize
pub fn col_count(&self) -> usize
Sourcepub fn cell_count(&self) -> u64
pub fn cell_count(&self) -> u64
Total cell count, saturating. WASM is a 32-bit platform, so a select-all
on a large sheet can overflow usize; saturating is the honest answer
because a number too large to count is not an actionable error.
Sourcepub fn with_anchor(self, cell: CellRef) -> Self
pub fn with_anchor(self, cell: CellRef) -> Self
A range with an explicit anchor, defaulting to the top-left corner.
Sourcepub fn extend_to(&self, cell: CellRef) -> Self
pub fn extend_to(&self, cell: CellRef) -> Self
Extends to include cell, keeping the original anchor. This is
shift-arrow behaviour: focus moves, the anchor does not.
Sourcepub fn iter_cells(&self) -> Vec<CellRef>
pub fn iter_cells(&self) -> Vec<CellRef>
The cells, in row-major order.
Source§impl CellRange
impl CellRange
Trait Implementations§
impl Copy for CellRange
Source§impl<'de> Deserialize<'de> for CellRange
impl<'de> Deserialize<'de> for CellRange
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for CellRange
Source§impl FromWasmAbi for CellRange
impl FromWasmAbi for CellRange
Source§impl IntoWasmAbi for CellRange
impl IntoWasmAbi for CellRange
Source§impl LongRefFromWasmAbi for CellRange
impl LongRefFromWasmAbi for CellRange
Source§impl OptionFromWasmAbi for CellRange
impl OptionFromWasmAbi for CellRange
Source§impl OptionIntoWasmAbi for CellRange
impl OptionIntoWasmAbi for CellRange
Source§impl RefFromWasmAbi for CellRange
impl RefFromWasmAbi for CellRange
Source§impl RefMutFromWasmAbi for CellRange
impl RefMutFromWasmAbi for CellRange
impl StructuralPartialEq for CellRange
impl SupportsConstructor for CellRange
impl SupportsInstanceProperty for CellRange
impl SupportsStaticProperty for CellRange
Source§impl TryFromJsValue for CellRange
impl TryFromJsValue for CellRange
Source§impl VectorFromWasmAbi for CellRange
impl VectorFromWasmAbi for CellRange
Source§impl VectorIntoWasmAbi for CellRange
impl VectorIntoWasmAbi for CellRange
Auto Trait Implementations§
impl Freeze for CellRange
impl RefUnwindSafe for CellRange
impl Send for CellRange
impl Sync for CellRange
impl Unpin for CellRange
impl UnsafeUnpin for CellRange
impl UnwindSafe for CellRange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.