pub struct BoundedCardinality { /* private fields */ }
Expand description
Contains a lower and upper bound Cardinality
used to bound the cardinality of a Set
.
Implementations§
Source§impl BoundedCardinality
impl BoundedCardinality
Sourcepub fn new(lower: Cardinality, upper: Cardinality) -> Option<Self>
pub fn new(lower: Cardinality, upper: Cardinality) -> Option<Self>
Creates an instance of BoundedCardinality
.
Returns None
iff lower > upper
.
Sourcepub fn new_exact(exact: Cardinality) -> Self
pub fn new_exact(exact: Cardinality) -> Self
Creates an instance of BoundedCardinality
with the lower and upper bounds both set to exact
.
Sourcepub fn from_biguint(lower: BigUint, upper: BigUint) -> Option<Self>
pub fn from_biguint(lower: BigUint, upper: BigUint) -> Option<Self>
Creates an instance of BoundedCardinality
with the lower and upper bounds as Cardinality::Finite
of their respective values.
Returns None
iff lower > upper
.
Sourcepub fn from_biguint_exact(exact: BigUint) -> Self
pub fn from_biguint_exact(exact: BigUint) -> Self
Creates an instance of BoundedCardinality
with the lower and upper bounds as Cardinality::Finite(exact)
.
Sourcepub const unsafe fn new_unsafe(lower: Cardinality, upper: Cardinality) -> Self
pub const unsafe fn new_unsafe(lower: Cardinality, upper: Cardinality) -> Self
Sourcepub const unsafe fn from_biguint_unsafe(lower: BigUint, upper: BigUint) -> Self
pub const unsafe fn from_biguint_unsafe(lower: BigUint, upper: BigUint) -> Self
Creates an instance of BoundedCardinality
with the lower and upper bounds as Cardinality::Finite
of their respective values without verifying lower <= upper
.
§Safety
lower <= upper
.
Sourcepub const fn lower(&self) -> &Cardinality
pub const fn lower(&self) -> &Cardinality
Returns a reference to the lower bound.
Sourcepub fn to_lower(self) -> Cardinality
pub fn to_lower(self) -> Cardinality
Returns the lower bound.
Sourcepub const fn upper(&self) -> &Cardinality
pub const fn upper(&self) -> &Cardinality
Returns a reference to the upper bound.
Sourcepub fn to_upper(self) -> Cardinality
pub fn to_upper(self) -> Cardinality
Returns the upper bound.
Sourcepub const fn lower_upper(&self) -> (&Cardinality, &Cardinality)
pub const fn lower_upper(&self) -> (&Cardinality, &Cardinality)
Returns a tuple containing the references to the lower and upper bounds respectively.
Sourcepub const fn lower_biguint(&self) -> &BigUint
pub const fn lower_biguint(&self) -> &BigUint
Returns a reference to the contained BigUint
of self.lower()
.
Sourcepub fn to_lower_biguint(self) -> BigUint
pub fn to_lower_biguint(self) -> BigUint
Returns the lower bound as a BigUint
.
Sourcepub const fn upper_biguint(&self) -> &BigUint
pub const fn upper_biguint(&self) -> &BigUint
Returns a reference to the contained BigUint
of self.upper()
.
Sourcepub fn to_upper_biguint(self) -> BigUint
pub fn to_upper_biguint(self) -> BigUint
Returns the upper bound as a BigUint
.
Sourcepub const fn lower_upper_biguint(&self) -> (&BigUint, &BigUint)
pub const fn lower_upper_biguint(&self) -> (&BigUint, &BigUint)
Returns a tuple of references to the contained BigUint
s of self.lower()
and self.upper()
respectively.
Trait Implementations§
Source§impl Clone for BoundedCardinality
impl Clone for BoundedCardinality
Source§fn clone(&self) -> BoundedCardinality
fn clone(&self) -> BoundedCardinality
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more