pub struct BitPos<T> where
T: BitStore, { /* private fields */ }
Expand description
Indicates a real electrical index within an element.
This type is produced by BitOrder
implementors, and marks a specific
electrical bit within a memory element, rather than BitIdx
’s semantic bit.
Type Parameters
Implementations
sourceimpl<T> BitPos<T> where
T: BitStore,
impl<T> BitPos<T> where
T: BitStore,
sourcepub fn new(pos: u8) -> Self
pub fn new(pos: u8) -> Self
Produce a new bit position marker at a valid position value.
BitOrder
implementations should prefer this method, but may use
::new_unchecked
if they can guarantee that the range invariant is
upheld.
Parameters
pos
: The bit position value to encode. It must be in the range0 .. T::BITS
.
Panics
This function panics if pos
is greater than or equal to T::BITS
.
sourcepub unsafe fn new_unchecked(pos: u8) -> Self
pub unsafe fn new_unchecked(pos: u8) -> Self
Produce a new bit position marker at any position value.
Safety
The caller must ensure that pos
is less than T::BITS
. BitOrder
implementations should prefer ::new
, which panics on range failure.
Parameters
pos
: The bit position value to encode. This must be in the range0 .. T::BITS
.
Returns
pos
wrapped in the BitPos
marker type.
Panics
This function panics if pos
is greater than or equal to T::BITS
, but
only in debug builds. It does not inspect pos
in release builds.
Trait Implementations
sourceimpl<T: Ord> Ord for BitPos<T> where
T: BitStore,
impl<T: Ord> Ord for BitPos<T> where
T: BitStore,
sourceimpl<T: PartialOrd> PartialOrd<BitPos<T>> for BitPos<T> where
T: BitStore,
impl<T: PartialOrd> PartialOrd<BitPos<T>> for BitPos<T> where
T: BitStore,
sourcefn partial_cmp(&self, other: &BitPos<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &BitPos<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 BitPos<T> where
T: BitStore,
impl<T: Eq> Eq for BitPos<T> where
T: BitStore,
impl<T> StructuralEq for BitPos<T> where
T: BitStore,
impl<T> StructuralPartialEq for BitPos<T> where
T: BitStore,
Auto Trait Implementations
impl<T> RefUnwindSafe for BitPos<T> where
T: RefUnwindSafe,
impl<T> Send for BitPos<T>
impl<T> Sync for BitPos<T>
impl<T> Unpin for BitPos<T> where
T: Unpin,
impl<T> UnwindSafe for BitPos<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