pub struct TypeVector { /* private fields */ }Expand description
Finite hyper-Catalan type vectors of the form [m2, m3, m4, ...].
Implementations§
Source§impl TypeVector
impl TypeVector
Sourcepub fn new(values: Vec<u64>) -> Result<Self, GeodeError>
pub fn new(values: Vec<u64>) -> Result<Self, GeodeError>
Creates a validated finite type vector.
The vector must contain at least one component, and the total face count
must still fit in u64 so face_count() remains exact.
§Errors
Returns GeodeError::EmptyTypeVector when values is empty.
Returns GeodeError::InvalidInput when the total face count would no
longer fit in u64.
Sourcepub const fn dimension(&self) -> usize
pub const fn dimension(&self) -> usize
Returns the current dimension of the finite type vector.
Sourcepub fn face_count(&self) -> u64
pub fn face_count(&self) -> u64
Returns the total face count.
Sourcepub fn incremented(&self, index: usize) -> Result<Self, GeodeError>
pub fn incremented(&self, index: usize) -> Result<Self, GeodeError>
Returns a copy with one checked increment at index.
§Errors
Returns GeodeError::IndexOutOfBounds when index is not present.
Returns GeodeError::ArithmeticOverflow when incrementing the chosen
component would overflow u64.
Returns GeodeError::InvalidInput when the resulting total face count
no longer fits in u64.
Sourcepub fn decremented(&self, index: usize) -> Result<Option<Self>, GeodeError>
pub fn decremented(&self, index: usize) -> Result<Option<Self>, GeodeError>
Returns a copy with one decrement at index, or None when already zero.
§Errors
Returns GeodeError::IndexOutOfBounds when index is not present.
Returns GeodeError::InvalidInput when the resulting total face count
no longer fits in u64.
Trait Implementations§
Source§impl Clone for TypeVector
impl Clone for TypeVector
Source§fn clone(&self) -> TypeVector
fn clone(&self) -> TypeVector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TypeVector
impl Debug for TypeVector
Source§impl Hash for TypeVector
impl Hash for TypeVector
Source§impl PartialEq for TypeVector
impl PartialEq for TypeVector
Source§fn eq(&self, other: &TypeVector) -> bool
fn eq(&self, other: &TypeVector) -> bool
self and other values to be equal, and is used by ==.