#[repr(u8)]pub enum PatternId {
Show 16 variants
One = 0,
Two = 1,
Three = 2,
Four = 3,
Five = 4,
Six = 5,
Seven = 6,
Eight = 7,
Nine = 8,
Ten = 9,
Eleven = 10,
Twelve = 11,
Thirteen = 12,
Fourteen = 13,
Fifteen = 14,
Sixteen = 15,
}Expand description
Identifier values for Patterns, allowing for panic-free indexing via id* methods.
use ot_tools_io::identifiers::PatternId;
use ot_tools_io::BankFile;
// mutable so we can demonstrate using `id_mut` methods
let mut bank = BankFile::default();
// using variant by hand
// -- pattern 1 (reference)
bank.patterns.id_ref(&PatternId::One);
// -- pattern 16 (mutable reference)
bank.patterns.id_mut(&PatternId::Sixteen);
// lookup from an unsigned integer value
// -- pattern 1 (reference)
bank.patterns.id_ref(&PatternId::try_from(0_usize)?);
// -- pattern 16 (mutable reference)
bank.patterns.id_mut(&PatternId::try_from(15_usize)?);
// iterate over variants
for pattern_id in PatternId::iter() {
bank.patterns.id_ref(&pattern_id);
}
Variants§
One = 0
Two = 1
Three = 2
Four = 3
Five = 4
Six = 5
Seven = 6
Eight = 7
Nine = 8
Ten = 9
Eleven = 10
Twelve = 11
Thirteen = 12
Fourteen = 13
Fifteen = 14
Sixteen = 15
Implementations§
Trait Implementations§
impl Copy for PatternId
impl Eq for PatternId
Source§impl Ord for PatternId
impl Ord for PatternId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for PatternId
impl PartialOrd for PatternId
Source§impl Sequence for PatternId
impl Sequence for PatternId
impl StructuralPartialEq for PatternId
Auto Trait Implementations§
impl Freeze for PatternId
impl RefUnwindSafe for PatternId
impl Send for PatternId
impl Sync for PatternId
impl Unpin for PatternId
impl UnsafeUnpin for PatternId
impl UnwindSafe for PatternId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more