Struct bitvec::index::BitPos [−][src]
#[repr(transparent)]pub struct BitPos<R> where
R: BitRegister, { /* fields omitted */ }
An electrical position counter within a register element R
.
This type is a counter in the ring 0 .. R::BITS
, and serves to mark an
electrical address of a real bit. It is the shift distance in the expression
1 << n
. It is only produced by applying a BitOrder::at
transformation to
some BitIdx
produced by this library.
Type Parameters
R
: The register element that this position governs.
Validity
Values of this type are required to be in the range 0 .. R::BITS
. Any
value not less than R::BITS
makes the program invalid, and will likely cause
a crash. In addition, BitOrder::at
has a list of requirements that its
implementations must uphold in order to make construction of this type
semantically correct in a program.
Construction
This type is publicly constructible. bitvec
will only request its creation
by calling BitOrder::at
, and has no sites that can publicly accept untrusted
values.
Implementations
impl<R> BitPos<R> where
R: BitRegister,
[src]
impl<R> BitPos<R> where
R: BitRegister,
[src]pub fn new(value: u8) -> Option<Self>
[src]
Wraps a counter value as a known-good position within an R
register.
Parameters
value
: The counter value to mark as a position. This must be in the range0 .. R::BITS
.
Returns
This returns Some(value)
when it is in the valid range 0 .. R::BITS
,
and None
when it is not.
pub unsafe fn new_unchecked(value: u8) -> Self
[src]
Wraps a counter value as an assumed-good position within an R
register.
Parameters
value
: The counter value to mark as a position. This must be in the range0 .. R::BITS
.
Returns
This returns value
, marked as a valid position.
Safety
If the value
is outside the valid range, then the program is
incorrect. Debug builds will panic; release builds do not inspect the
value
.
pub fn value(self) -> u8
[src]
Removes the position wrapper, leaving the internal counter.
pub fn select(self) -> BitSel<R>
[src]
Computes the bit selector corresponding to self
.
This is always 1 << self.pos
.
pub fn mask(self) -> BitMask<R>
[src]
Computes the bit selector for self
as an accessor mask.
This is a type-cast over Self::select
.
Trait Implementations
impl<R> Binary for BitPos<R> where
R: BitRegister,
[src]
impl<R> Binary for BitPos<R> where
R: BitRegister,
[src]impl<R: Clone> Clone for BitPos<R> where
R: BitRegister,
[src]
impl<R: Clone> Clone for BitPos<R> where
R: BitRegister,
[src]impl<R> Debug for BitPos<R> where
R: BitRegister,
[src]
impl<R> Debug for BitPos<R> where
R: BitRegister,
[src]impl<R> Display for BitPos<R> where
R: BitRegister,
[src]
impl<R> Display for BitPos<R> where
R: BitRegister,
[src]impl<R: Hash> Hash for BitPos<R> where
R: BitRegister,
[src]
impl<R: Hash> Hash for BitPos<R> where
R: BitRegister,
[src]impl<R: Ord> Ord for BitPos<R> where
R: BitRegister,
[src]
impl<R: Ord> Ord for BitPos<R> where
R: BitRegister,
[src]impl<R: PartialOrd> PartialOrd<BitPos<R>> for BitPos<R> where
R: BitRegister,
[src]
impl<R: PartialOrd> PartialOrd<BitPos<R>> for BitPos<R> where
R: BitRegister,
[src]impl<R: Copy> Copy for BitPos<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Eq> Eq for BitPos<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> StructuralEq for BitPos<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> StructuralPartialEq for BitPos<R> where
R: BitRegister,
[src]
R: BitRegister,
Auto Trait Implementations
impl<R> RefUnwindSafe for BitPos<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
impl<R> Send for BitPos<R>
impl<R> Sync for BitPos<R>
impl<R> Unpin for BitPos<R>
impl<R> UnwindSafe for BitPos<R> where
R: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> FmtForward for T
[src]
impl<T> FmtForward for T
[src]pub fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
[src]
Self: Binary,
pub fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
[src]
Self: Display,
pub fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
[src]
Self: LowerExp,
pub fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
[src]
Self: LowerHex,
pub fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
[src]
Self: Octal,
pub fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
[src]
Self: Pointer,
pub fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
[src]
Self: UpperExp,
pub fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
[src]
Self: UpperHex,
impl<T> Pipe for T where
T: ?Sized,
[src]
impl<T> Pipe for T where
T: ?Sized,
[src]pub fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
[src]
pub fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
[src]
R: 'a,
pub fn pipe_ref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self) -> R
) -> R where
R: 'a,
[src]
&'a mut self,
func: impl FnOnce(&'a mut Self) -> R
) -> R where
R: 'a,
pub fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
[src]
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
pub fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
[src]
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
pub fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
R: 'a,
U: 'a + ?Sized,
[src]
Self: AsRef<U>,
R: 'a,
U: 'a + ?Sized,
pub fn pipe_as_mut<'a, U, R>(
&'a mut self,
func: impl FnOnce(&'a mut U) -> R
) -> R where
Self: AsMut<U>,
R: 'a,
U: 'a + ?Sized,
[src]
&'a mut self,
func: impl FnOnce(&'a mut U) -> R
) -> R where
Self: AsMut<U>,
R: 'a,
U: 'a + ?Sized,
pub fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
[src]
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
pub fn pipe_deref_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: DerefMut<Target = T> + Deref,
T: 'a + ?Sized,
R: 'a,
[src]
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: DerefMut<Target = T> + Deref,
T: 'a + ?Sized,
R: 'a,
impl<T> PipeAsRef for T
[src]
impl<T> PipeAsRef for T
[src]pub fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
[src]
Self: AsRef<T>,
T: 'a,
R: 'a,
pub fn pipe_as_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
[src]
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
impl<T> PipeBorrow for T
[src]
impl<T> PipeBorrow for T
[src]pub fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
[src]
Self: Borrow<T>,
T: 'a,
R: 'a,
pub fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
[src]
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
impl<T> PipeDeref for T
[src]
impl<T> PipeDeref for T
[src]pub fn pipe_deref<'a, R>(
&'a self,
func: impl FnOnce(&'a Self::Target) -> R
) -> R where
Self: Deref,
R: 'a,
[src]
&'a self,
func: impl FnOnce(&'a Self::Target) -> R
) -> R where
Self: Deref,
R: 'a,
pub fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
[src]
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
impl<T> Tap for T
[src]
impl<T> Tap for T
[src]pub fn tap(self, func: impl FnOnce(&Self)) -> Self
[src]
pub fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self
[src]
pub fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
[src]
Self: Borrow<B>,
B: ?Sized,
pub fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
[src]
Self: BorrowMut<B>,
B: ?Sized,
pub fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
[src]
Self: AsRef<R>,
R: ?Sized,
pub fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
[src]
Self: AsMut<R>,
R: ?Sized,
pub fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
[src]
Self: Deref<Target = T>,
T: ?Sized,
pub fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
[src]
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
pub fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
[src]
pub fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
[src]
pub fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
[src]
Self: Borrow<B>,
B: ?Sized,
pub fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
[src]
Self: BorrowMut<B>,
B: ?Sized,
pub fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
[src]
Self: AsRef<R>,
R: ?Sized,
pub fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
[src]
Self: AsMut<R>,
R: ?Sized,
pub fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
[src]
Self: Deref<Target = T>,
T: ?Sized,
pub fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
[src]
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
impl<T> Tap for T
[src]
impl<T> Tap for T
[src]pub fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
[src]
F: FnOnce(&Self) -> R,
pub fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
[src]
F: FnOnce(&Self) -> R,
pub fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
[src]
F: FnOnce(&mut Self) -> R,
pub fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
[src]
F: FnOnce(&mut Self) -> R,
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
[src]
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
[src]pub fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
[src]
Self: AsRef<T>,
F: FnOnce(&T) -> R,
pub fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
[src]
Self: AsRef<T>,
F: FnOnce(&T) -> R,
pub fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
[src]
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
pub fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
[src]
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
[src]
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
[src]pub fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
[src]
Self: Borrow<T>,
F: FnOnce(&T) -> R,
pub fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
[src]
Self: Borrow<T>,
F: FnOnce(&T) -> R,
pub fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
[src]
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
pub fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
[src]
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
impl<T> TapDeref for T
[src]
impl<T> TapDeref for T
[src]pub fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
[src]
Self: Deref,
F: FnOnce(&Self::Target) -> R,
pub fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
[src]
Self: Deref,
F: FnOnce(&Self::Target) -> R,
pub fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
[src]
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
pub fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
[src]
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,