#[repr(transparent)]pub(super) struct WrappedIndex(usize);Expand description
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).
Tuple Fields§
§0: usizeImplementations§
Source§impl WrappedIndex
impl WrappedIndex
Sourcepub(super) fn from_arbitrary_number(index: usize) -> Self
pub(super) fn from_arbitrary_number(index: usize) -> Self
The newly constructed index has to be in-bounds for the VecDeque that uses the index.
Sourcepub(super) unsafe fn add(self, offset: usize) -> Self
pub(super) unsafe fn add(self, offset: usize) -> Self
Safety invariant: the newly constructed index must still be in-bounds for the VecDeque
Sourcepub(super) unsafe fn sub(self, offset: usize) -> Self
pub(super) unsafe fn sub(self, offset: usize) -> Self
Safety invariant: the newly constructed index must still be in-bounds for the VecDeque
pub(super) const fn zero() -> Self
pub(super) fn abs_diff(self, other: Self) -> usize
pub(super) fn as_index(self) -> usize
pub(super) fn is_zero(self) -> bool
Trait Implementations§
Source§impl Add<usize> for WrappedIndex
impl Add<usize> for WrappedIndex
Source§impl Clone for WrappedIndex
impl Clone for WrappedIndex
Source§fn clone(&self) -> WrappedIndex
fn clone(&self) -> WrappedIndex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WrappedIndex
impl Debug for WrappedIndex
Source§impl Display for WrappedIndex
impl Display for WrappedIndex
Source§impl Eq for WrappedIndex
impl Eq for WrappedIndex
Source§#[doc(hidden)]fn assert_fields_are_eq(&self)
#[doc(hidden)]fn assert_fields_are_eq(&self)
🔬This is a nightly-only experimental API. (
derive_eq_internals)1.0.0 (const: unstable) · Source§#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
👎Deprecated since 1.95.0:
implementation detail of #[derive(Eq)]
Source§impl Ord for WrappedIndex
impl Ord for WrappedIndex
Source§fn cmp(&self, other: &WrappedIndex) -> Ordering
fn cmp(&self, other: &WrappedIndex) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq<usize> for WrappedIndex
impl PartialEq<usize> for WrappedIndex
Source§impl PartialEq for WrappedIndex
impl PartialEq for WrappedIndex
Source§fn eq(&self, other: &WrappedIndex) -> bool
fn eq(&self, other: &WrappedIndex) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd<usize> for WrappedIndex
impl PartialOrd<usize> for WrappedIndex
Source§#[doc(hidden)]fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)If
self == other, returns ControlFlow::Continue(()).
Otherwise, returns ControlFlow::Break(self < other). Read moreSource§#[doc(hidden)]fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)Same as
__chaining_lt, but for <= instead of <.Source§#[doc(hidden)]fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)Same as
__chaining_lt, but for > instead of <.Source§#[doc(hidden)]fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)Same as
__chaining_lt, but for >= instead of <.Source§impl PartialOrd for WrappedIndex
impl PartialOrd for WrappedIndex
Source§fn partial_cmp(&self, other: &WrappedIndex) -> Option<Ordering>
fn partial_cmp(&self, other: &WrappedIndex) -> Option<Ordering>
Source§#[doc(hidden)]fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)If
self == other, returns ControlFlow::Continue(()).
Otherwise, returns ControlFlow::Break(self < other). Read moreSource§#[doc(hidden)]fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)Same as
__chaining_lt, but for <= instead of <.Source§#[doc(hidden)]fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)Same as
__chaining_lt, but for > instead of <.Source§#[doc(hidden)]fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)Same as
__chaining_lt, but for >= instead of <.impl Copy for WrappedIndex
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
🔬This is a nightly-only experimental API. (
ptr_alignment_type #102070)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)The largest safe length for a
[Self]. Read more