Struct TypeVector
pub struct TypeVector { /* private fields */ }Expand description
Finite hyper-Catalan type vectors of the form [m2, m3, m4, ...].
Implementations§
§impl TypeVector
impl TypeVector
pub fn new(values: Vec<u64>) -> Result<TypeVector, GeodeError>
pub fn new(values: Vec<u64>) -> Result<TypeVector, 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.
pub fn face_count(&self) -> u64
pub fn face_count(&self) -> u64
Returns the total face count.
pub fn incremented(&self, index: usize) -> Result<TypeVector, GeodeError>
pub fn incremented(&self, index: usize) -> Result<TypeVector, 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.
pub fn decremented(
&self,
index: usize,
) -> Result<Option<TypeVector>, GeodeError>
pub fn decremented( &self, index: usize, ) -> Result<Option<TypeVector>, 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.
pub fn trimmed(&self) -> TypeVector
pub fn trimmed(&self) -> TypeVector
Removes trailing zeroes while keeping at least one component.
Trait Implementations§
§impl Clone for TypeVector
impl Clone for TypeVector
§fn clone(&self) -> TypeVector
fn clone(&self) -> TypeVector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more