Struct WrappedIndex
#[repr(transparent)]
pub(in ::collections::vec_deque) struct WrappedIndex(pub(in ::collections::vec_deque::index) usize);
Represents an index that can be safely used to index the VecDeque buffer. It exists as a separate type to avoid passing logical (unwrapped) indices to various VecDeque functions by accident.
The invariant of this index is that it is always < VecDeque capacity, unless the VecDeque is empty (in that case the index can be 0 when the capacity is 0).
Fields
0: usize
Implementations
impl WrappedIndex
fn from_arbitrary_number(index: usize) -> SelfThe newly constructed index has to be in-bounds for the VecDeque that uses the index.
unsafe fn add(self, offset: usize) -> SelfSafety invariant: the newly constructed index must still be in-bounds for the VecDeque
unsafe fn sub(self, offset: usize) -> SelfSafety invariant: the newly constructed index must still be in-bounds for the VecDeque
const fn zero() -> Selffn abs_diff(self, other: Self) -> usizefn as_index(self) -> usizefn is_zero(self) -> bool
Trait Implementations
impl Add<usize> for WrappedIndex
type Output = usize;fn add(self, rhs: usize) -> Self::Output
impl Clone for WrappedIndex
fn clone(&self) -> WrappedIndex
impl Copy for WrappedIndex
impl Debug for WrappedIndex
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for WrappedIndex
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for WrappedIndex
fn assert_fields_are_eq(&self)
impl Ord for WrappedIndex
fn cmp(&self, other: &WrappedIndex) -> Ordering
impl PartialEq for WrappedIndex
fn eq(&self, other: &WrappedIndex) -> bool
impl PartialEq<usize> for WrappedIndex
fn eq(&self, other: &usize) -> bool
impl PartialOrd for WrappedIndex
fn partial_cmp(&self, other: &WrappedIndex) -> Option<Ordering>
impl PartialOrd<usize> for WrappedIndex
fn partial_cmp(&self, other: &usize) -> Option<Ordering>
impl StructuralPartialEq for WrappedIndex
impl TrivialClone for WrappedIndex
Auto Trait Implementations
impl Freeze for WrappedIndex
impl RefUnwindSafe for WrappedIndex
impl Send for WrappedIndex
impl Sync for WrappedIndex
impl Unpin for WrappedIndex
impl UnsafeUnpin for WrappedIndex
impl UnwindSafe for WrappedIndex
Blanket Implementations
impl<T> Any for WrappedIndex
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for WrappedIndex
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for WrappedIndex
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for WrappedIndex
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for WrappedIndex
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Printable for WrappedIndex
where
T: Copy + Debug,
impl<T> SizeHint for WrappedIndex
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for WrappedIndex
impl<T> ToOwned for WrappedIndex
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for WrappedIndex
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for WrappedIndex
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for WrappedIndex
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for WrappedIndex
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>