pub struct PackedCoord(/* private fields */);Expand description
Bit-packed coordinate representation for memory efficiency
Layout (64 bits): [63:44] Reserved (20 bits) - MUST BE ZERO [43:24] Row (20 bits) - 0 to 1,048,575 (zero-based) [23:10] Col (14 bits) - 0 to 16,383 (zero-based) [9:0] Reserved (10 bits) - MUST BE ZERO
Implementations§
Source§impl PackedCoord
impl PackedCoord
pub const INVALID: Self
pub const RESERVED_MASK: u64 = 18_446_726_481_523_508_223u64
Sourcepub fn new(row: u32, col: u32) -> Self
pub fn new(row: u32, col: u32) -> Self
Creates a new PackedCoord from row and column indices
§Safety Invariants
- Row must be <= 1,048,575 (20 bits)
- Column must be <= 16,383 (14 bits)
- Reserved bits [63:44] and [9:0] MUST remain zero
pub fn row(self) -> u32
pub fn col(self) -> u32
pub fn as_u64(self) -> u64
pub fn is_valid(self) -> bool
pub fn normalize(self) -> Self
Trait Implementations§
Source§impl Clone for PackedCoord
impl Clone for PackedCoord
Source§fn clone(&self) -> PackedCoord
fn clone(&self) -> PackedCoord
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PackedCoord
impl Debug for PackedCoord
Source§impl Hash for PackedCoord
impl Hash for PackedCoord
Source§impl PartialEq for PackedCoord
impl PartialEq for PackedCoord
impl Copy for PackedCoord
impl Eq for PackedCoord
impl StructuralPartialEq for PackedCoord
Auto Trait Implementations§
impl Freeze for PackedCoord
impl RefUnwindSafe for PackedCoord
impl Send for PackedCoord
impl Sync for PackedCoord
impl Unpin for PackedCoord
impl UnwindSafe for PackedCoord
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> 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