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);

Stages with names will also be Displayed as their names:

assert_eq!(&format!("{}", Stage::MAXIMUS), "Maximus");
assert_eq!(&format!("{}", Stage::from(9)), "Caters");

Implementations

Returns this Stage as a usize.

Example

use proj_core::Stage;

assert_eq!(Stage::DOUBLES.as_usize(), 5);
assert_eq!(Stage::MAXIMUS.as_usize(), 12);

Returns true if this Stage has an even number of bells

User-friendly constants for commonly used Stages.

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));

A Stage with no bells

A Stage with 1 ‘working’ bell

A Stage with 2 working bells

A Stage with 3 working bells

A Stage with 4 working bells

A Stage with 5 working bells

A Stage with 6 working bells

A Stage with 7 working bells

A Stage with 8 working bells

A Stage with 9 working bells

A Stage with 10 working bells

A Stage with 11 working bells

A Stage with 12 working bells

A Stage with 13 working bells

A Stage with 14 working bells

A Stage with 15 working bells

A Stage with 16 working bells

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.