pub struct Coord {
pub row: u32,
pub col: u32,
/* private fields */
}Expand description
One 2‑D grid coordinate (row, column) plus absolute/relative flags.
rowandcolare zero‑based indices.flagsis a 2‑bit field:bit0 = row_abs,bit1 = col_abs.
Fields§
§row: u32§col: u32Implementations§
Source§impl Coord
impl Coord
Sourcepub const fn new(row: u32, col: u32, row_abs: bool, col_abs: bool) -> Self
pub const fn new(row: u32, col: u32, row_abs: bool, col_abs: bool) -> Self
Creates a new coordinate.
pub const fn col_abs(self) -> bool
Sourcepub const fn with_row_abs(self, abs: bool) -> Self
pub const fn with_row_abs(self, abs: bool) -> Self
Returns a copy with modified row anchor.
Sourcepub const fn with_col_abs(self, abs: bool) -> Self
pub const fn with_col_abs(self, abs: bool) -> Self
Returns a copy with modified col anchor.
Sourcepub const fn offset(self, drow: i32, dcol: i32) -> Self
pub const fn offset(self, drow: i32, dcol: i32) -> Self
Offset by signed deltas ignoring anchor flags (internal helper).
Sourcepub fn rebase(self, origin: Coord, target: Coord) -> Self
pub fn rebase(self, origin: Coord, target: Coord) -> Self
Re‐base this coordinate as if the formula containing it was copied
from origin to target.
Sourcepub fn col_to_letters(col: u32) -> String
pub fn col_to_letters(col: u32) -> String
Convert col into Excel‑style letters (0‑based ⇒ A, B, …, AA…).
Sourcepub fn letters_to_col(s: &str) -> Option<u32>
pub fn letters_to_col(s: &str) -> Option<u32>
Convert Excel letters (e.g., “AA”) back to 0‑based column index.
Trait Implementations§
Source§impl Ord for Coord
impl Ord for Coord
Source§impl PartialOrd for Coord
impl PartialOrd for Coord
impl Copy for Coord
impl Eq for Coord
impl StructuralPartialEq for Coord
Auto Trait Implementations§
impl Freeze for Coord
impl RefUnwindSafe for Coord
impl Send for Coord
impl Sync for Coord
impl Unpin for Coord
impl UnwindSafe for Coord
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more