Struct zfc::BoundedCardinality
source · 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§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BoundedCardinality
impl Debug for BoundedCardinality
source§impl Display for BoundedCardinality
impl Display for BoundedCardinality
source§impl From<BigUint> for BoundedCardinality
impl From<BigUint> for BoundedCardinality
source§impl From<BoundedCardinality> for (BigUint, BigUint)
impl From<BoundedCardinality> for (BigUint, BigUint)
source§fn from(value: BoundedCardinality) -> Self
fn from(value: BoundedCardinality) -> Self
source§impl From<BoundedCardinality> for (Cardinality, Cardinality)
impl From<BoundedCardinality> for (Cardinality, Cardinality)
source§fn from(value: BoundedCardinality) -> Self
fn from(value: BoundedCardinality) -> Self
source§impl From<Cardinality> for BoundedCardinality
impl From<Cardinality> for BoundedCardinality
source§fn from(value: Cardinality) -> Self
fn from(value: Cardinality) -> Self
source§impl Hash for BoundedCardinality
impl Hash for BoundedCardinality
source§impl Ord for BoundedCardinality
impl Ord for BoundedCardinality
source§fn cmp(&self, other: &BoundedCardinality) -> Ordering
fn cmp(&self, other: &BoundedCardinality) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for BoundedCardinality
impl PartialEq for BoundedCardinality
source§fn eq(&self, other: &BoundedCardinality) -> bool
fn eq(&self, other: &BoundedCardinality) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for BoundedCardinality
impl PartialOrd for BoundedCardinality
source§fn partial_cmp(&self, other: &BoundedCardinality) -> Option<Ordering>
fn partial_cmp(&self, other: &BoundedCardinality) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more