pub struct EnumIndex<T: Enumoid>(/* private fields */);
Expand description
A counter between 0 and the highest index into the values inhabiting T
.
Implementations§
source§impl<T: Enumoid> EnumIndex<T>
impl<T: Enumoid> EnumIndex<T>
pub fn from_usize(sz: usize) -> Option<Self>
pub fn from_value(value: T) -> Self
pub fn into_value(self) -> T
pub fn into_word(self) -> T::Word
pub fn into_usize(self) -> usize
sourcepub fn next_wrapped(self) -> Self
pub fn next_wrapped(self) -> Self
Returns the next index or wraps around to the beginning.
sourcepub fn prev_wrapped(self) -> Self
pub fn prev_wrapped(self) -> Self
Returns the previous index or wraps around to the end.
Trait Implementations§
source§impl<T: Ord + Enumoid> Ord for EnumIndex<T>
impl<T: Ord + Enumoid> Ord for EnumIndex<T>
1.21.0 · 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<T: PartialEq + Enumoid> PartialEq for EnumIndex<T>
impl<T: PartialEq + Enumoid> PartialEq for EnumIndex<T>
source§impl<T: PartialOrd + Enumoid> PartialOrd for EnumIndex<T>where
T::Word: PartialOrd,
impl<T: PartialOrd + Enumoid> PartialOrd for EnumIndex<T>where
T::Word: PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T: Enumoid> Copy for EnumIndex<T>
impl<T: Eq + Enumoid> Eq for EnumIndex<T>
impl<T: Enumoid> StructuralPartialEq for EnumIndex<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for EnumIndex<T>
impl<T> Send for EnumIndex<T>
impl<T> Sync for EnumIndex<T>
impl<T> Unpin for EnumIndex<T>
impl<T> UnwindSafe for EnumIndex<T>
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