Skip to main content

Coord

Struct Coord 

Source
pub struct Coord(/* private fields */);
Expand description

Absolute grid coordinate (row, column) with Excel-compatible bounds.

Implementations§

Source§

impl Coord

Source

pub const INVALID: Self

Source

pub fn new(row: u32, col: u32) -> Self

Construct a coordinate, panicking if values exceed the supported limits.

Source

pub fn from_excel(row: u32, col: u32) -> Self

Construct from Excel 1-based coordinates.

Source

pub fn try_new(row: u32, col: u32) -> Result<Self, CoordError>

Fallible constructor that reports overflow rather than panicking.

Source

pub fn from_raw(raw: u64) -> Result<Self, CoordError>

Reconstruct from a raw packed value, ensuring reserved bits stay zero.

Source

pub fn row(self) -> u32

Source

pub fn col(self) -> u32

Source

pub fn as_u64(self) -> u64

Source

pub fn is_valid(self) -> bool

Source

pub fn normalize(self) -> Self

Clear any reserved bits in-place. Useful before serialisation.

Source

pub fn into_relative(self) -> RelativeCoord

Convert to a relative coordinate with absolute anchors on both axes.

Source

pub fn try_from_a1(input: &str) -> Result<Self, A1ParseError>

Parse an A1-style reference (e.g. "A1", "$B$12") into a Coord.

Trait Implementations§

Source§

impl Clone for Coord

Source§

fn clone(&self) -> Coord

Returns a duplicate 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 Coord

Source§

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

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

impl From<Coord> for (u32, u32)

Source§

fn from(coord: Coord) -> Self

Converts to this type from the input type.
Source§

impl From<Coord> for RelativeCoord

Source§

fn from(coord: Coord) -> Self

Converts to this type from the input type.
Source§

impl From<RelativeCoord> for Coord

Source§

fn from(value: RelativeCoord) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Coord

Source§

type Err = A1ParseError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Coord

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Coord

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&str> for Coord

Source§

type Error = A1ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(value: &str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<(i64, i64)> for Coord

Source§

type Error = CoordError

The type returned in the event of a conversion error.
Source§

fn try_from(value: (i64, i64)) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<(u32, u32)> for Coord

Source§

type Error = CoordError

The type returned in the event of a conversion error.
Source§

fn try_from(value: (u32, u32)) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for Coord

Source§

impl Eq for Coord

Source§

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 UnsafeUnpin for Coord

§

impl UnwindSafe for Coord

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.