Struct bitvec::index::BitEnd [−][src]
#[repr(transparent)]pub struct BitEnd<R> where
R: BitRegister, { /* fields omitted */ }
A semantic index counter within or one bit past the end of a register
element R
.
This type is a counter in the ring 0 ..= R::BITS
, and serves to mark a
semantic index of a dead bit after a live region. As such, following in the
C++ and LLVM memory model of first-live/first-dead region descriptiors, it marks
an endpoint outside some bit-region, and may be used to compute the startpoint
of a bit-region immediately succeeding, but not overlapping, the source.
As a dead-bit index, this cannot be used for indexing into a register. It is used only in abstract region computation.
This type is necessary in order to preserve the distinction between a dead
memory address that is not part of a buffer and a live memory address that is
within a region. BitIdx
is insufficient to this task, and causes buffer
management errors when used in its stead.
Type Parameters
R
: The register element that this end index governs.
Validity
Values of this type are required to be in the range 0 ..= R::BITS
. Any
value greater than R::BITS
makes the program invalid, and will likely cause
either a crash or incorrect memory access.
Construction
This type can only be publicly constructed through BitIdx::span
.
Implementations
impl<R> BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
pub const LAST: Self
[src]
The inclusive maximum tail within an element R
.
pub const ZERO: Self
[src]
The inclusive minimum tail within an element R
.
pub fn new(value: u8) -> Option<Self>
[src]
Wraps a counter value as a known-good tail of an R
register.
Parameters
value
: The counter value to mark as a tail. This must be not less thanSelf::ZERO
and not more thanSelf::LAST
.
Returns
This returns Some(value)
when it is in the valid range 0 .. R::BITS
,
and None
when it is not.
pub fn into_inner(self) -> u8
[src]
Removes the tail wrapper, leaving the internal counter.
pub fn range_from(
from: BitIdx<R>
) -> impl Iterator<Item = Self> + DoubleEndedIterator + ExactSizeIterator + FusedIterator
[src]
from: BitIdx<R>
) -> impl Iterator<Item = Self> + DoubleEndedIterator + ExactSizeIterator + FusedIterator
Iterates over all tail indices at and after an inclusive starting point.
Because implementation details of the range type family, including the
RangeBounds
trait, are not yet stable, and heterogenous ranges are
not yet supported, this must be an opaque iterator rather than a direct
Range<BitEnd<R>>
.
Parameters
from
: The inclusive low bound of the range. This will be the first tail produced by the iterator.
Returns
An opaque iterator that is equivalent to the range from ..= Self::LAST
.
pub fn span(self, len: usize) -> (usize, Self)
[src]
Computes the span information for a region beginning immediately after a preceding region.
The computed region of len
bits has its start at the live bit that
corresponds to the self
dead tail. The return value is the number of
memory elements containing live bits of the computed span and its tail
marker.
Parameters
self
: A dead bit immediately after some region.len
: The number of live bits in the span starting afterself
.
Returns
.0
: The number of elementsR
that contain live bits in the computed region..1
: The tail counter of the first dead bit after the new span.
Behavior
If len
is 0
, this returns (0, self)
, as the span has no live bits.
If self
is BitEnd::LAST
, then the new region starts at
BitIdx::ZERO
in the next element.
Trait Implementations
impl<R> Binary for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Clone> Clone for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Copy> Copy for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> Debug for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Default> Default for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> Display for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Eq> Eq for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Hash> Hash for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<R: Ord> Ord for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
fn cmp(&self, other: &BitEnd<R>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<R: PartialEq> PartialEq<BitEnd<R>> for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: PartialOrd> PartialOrd<BitEnd<R>> for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
fn partial_cmp(&self, other: &BitEnd<R>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<R> StructuralEq for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> StructuralPartialEq for BitEnd<R> where
R: BitRegister,
[src]
R: BitRegister,
Auto Trait Implementations
impl<R> RefUnwindSafe for BitEnd<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
impl<R> Send for BitEnd<R>
impl<R> Sync for BitEnd<R>
impl<R> Unpin for BitEnd<R>
impl<R> UnwindSafe for BitEnd<R> where
R: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Conv 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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pipe for T where
T: ?Sized,
[src]
T: ?Sized,
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> 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> TryConv for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,