pub struct BitIdx<T> where
T: BitStore, { /* private fields */ }
Expand description
Indicates a semantic index of a bit within a memory element.
This type is consumed by BitOrder
implementors, which use it to produce a
concrete bit position inside an element.
BitIdx
is a semantic counter which has a defined, constant, and predictable
ordering. Values of BitIdx
refer strictly to an abstract ordering, and not to
any actual bit positions within a memory element, so BitIdx::<T>(0)
is always
the first bit counted within an element, but is not required to be the most or
least significant bits, or any other particular bits. Which specific bit is
referred by a BitIdx
value is governed by implementors of BitOrder
.
Type Parameters
T
: The memory element type controlled by this index.
Implementations
sourceimpl<T> BitIdx<T> where
T: BitStore,
impl<T> BitIdx<T> where
T: BitStore,
sourcepub fn new(idx: u8) -> Option<Self>
pub fn new(idx: u8) -> Option<Self>
Wraps a counter value as a known-good index of the T
element type.
Parameters
idx
: A semantic index within aT
memory element.
Returns
If idx
is within the range 0 .. T::BITS
, then this returns the index
value wrapped in the index type; if idx
exceeds this range, then this
returns None
.
Trait Implementations
sourceimpl<T: Ord> Ord for BitIdx<T> where
T: BitStore,
impl<T: Ord> Ord for BitIdx<T> where
T: BitStore,
sourceimpl<T: PartialOrd> PartialOrd<BitIdx<T>> for BitIdx<T> where
T: BitStore,
impl<T: PartialOrd> PartialOrd<BitIdx<T>> for BitIdx<T> where
T: BitStore,
sourcefn partial_cmp(&self, other: &BitIdx<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &BitIdx<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl<T: Copy> Copy for BitIdx<T> where
T: BitStore,
impl<T: Eq> Eq for BitIdx<T> where
T: BitStore,
impl<T> StructuralEq for BitIdx<T> where
T: BitStore,
impl<T> StructuralPartialEq for BitIdx<T> where
T: BitStore,
Auto Trait Implementations
impl<T> RefUnwindSafe for BitIdx<T> where
T: RefUnwindSafe,
impl<T> Send for BitIdx<T>
impl<T> Sync for BitIdx<T>
impl<T> Unpin for BitIdx<T> where
T: Unpin,
impl<T> UnwindSafe for BitIdx<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more