Struct bellframe::Stage [−][src]
#[repr(transparent)]pub struct Stage(_);
Expand description
A newtype over usize
that represents a stage.
To create a new Stage
, you can either create it directly by using Stage::from(usize)
or use
a constant for the human name for each Stage
:
use proj_core::Stage; // Converting from numbers is the same as using the constants assert_eq!(Stage::SINGLES, Stage::from(3)); assert_eq!(Stage::MAJOR, Stage::from(8)); assert_eq!(Stage::CINQUES, Stage::from(11)); assert_eq!(Stage::SIXTEEN, Stage::from(16)); // We can use `Stage::from` to generate `Stage`s that don't have names assert_eq!(Stage::from(2).as_usize(), 2); assert_eq!(Stage::from(100).as_usize(), 100);
Stage
s with names will also be Display
ed as their names:
assert_eq!(&format!("{}", Stage::MAXIMUS), "Maximus"); assert_eq!(&format!("{}", Stage::from(9)), "Caters");
Implementations
User-friendly constants for commonly used Stage
s.
Example
use proj_core::Stage; assert_eq!(Stage::MINIMUS, Stage::from(4)); assert_eq!(Stage::MINOR, Stage::from(6)); assert_eq!(Stage::TRIPLES, Stage::from(7)); assert_eq!(Stage::FOURTEEN, Stage::from(14)); assert_eq!(Stage::SEXTUPLES, Stage::from(15));
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Stage
impl UnwindSafe for Stage
Blanket Implementations
Mutably borrows from an owned value. Read more