Skip to main content

StableIndexVecDeque

Struct StableIndexVecDeque 

Source
pub struct StableIndexVecDeque<T, I>
where I: Offset,
{ /* private fields */ }
Expand description

Double-ended queue with stable indices

Implementations§

Source§

impl<T, I> Deque<T, I>
where I: Offset,

Source

pub fn new() -> Deque<T, I>

Source

pub fn with_capacity(cap: usize) -> Deque<T, I>

Like VecDeque::with_capacity

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn front(&self) -> Option<&T>

Source

pub fn back(&self) -> Option<&T>

Source

pub fn front_mut(&mut self) -> Option<&mut T>

Source

pub fn back_mut(&mut self) -> Option<&mut T>

Source

pub fn get(&self, i: I) -> Option<&T>

Returns the element with index i, if it is still in the deque.

Source

pub fn get_mut(&mut self, i: I) -> Option<&mut T>

Source

pub fn push_front(&mut self, e: T) -> I

Panics on index overflow.

Source

pub fn push_back(&mut self, e: T) -> I

Panics on index overflow.

Source

pub fn pop_front(&mut self) -> Option<T>

Panics on index overflow.

Source

pub fn pop_back(&mut self) -> Option<T>

Panics on index overflow.

Source

pub fn swap_remove_front(&mut self, i: I) -> Option<T>

Removes the element with index i, by replacing it with the eleement from the front. Invalidates the index of the front element element (now i refers to that) but leaves other indices valid. Panics on index overflow.

Source

pub fn swap_remove_back(&mut self, i: I) -> Option<T>

Removes the element with index i, by replacing it with the eleement from the back. Invalidates the index of the back element (now i refers to that), but leaves other indices valid. Panics on index overflow.

Source

pub fn front_index(&self) -> I

The index of the first item the deque. If the queue is empty, this is the same as end_index.

Source

pub fn end_index(&self) -> I

The index just after the end of the qeue. I.e., the index that would be assigned to a new element added with push_back. Panics on index overflow.

Source

pub fn iter(&self) -> Iter<'_, T, I>

Returns a (front-to-back) iterator.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T, I>

Returns a (front-to-back) iterator which returns mutable references.

Source

pub fn counter(&self) -> &I

I is how many more times pop_front has been called than push_back.

Source

pub fn counter_mut(&mut self) -> &mut I

Modifying this invalidates all indices.

Source

pub fn inner(&self) -> &VecDeque<T>

Allos access to the VecDeque inside this Deque

Source

pub fn inner_mut(&mut self) -> &mut VecDeque<T>

Mutable access to the VecDeque inside this Dequeu. Adding/removing elements at the front of of the VecDeque invalidates all indices.

Source

pub fn into_parts(self) -> (I, VecDeque<T>)

Source

pub fn from_parts(advanced: I, v: VecDeque<T>) -> Deque<T, I>

Source

pub fn as_parts(&self) -> (&I, &VecDeque<T>)

Source

pub fn as_mut_parts(&mut self) -> (&mut I, &mut VecDeque<T>)

Modifying the parts inconsistently will invalidate indices.

Trait Implementations§

Source§

impl<T, I> Clone for Deque<T, I>
where T: Clone, I: Clone + Offset,

Source§

fn clone(&self) -> Deque<T, I>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, I> Debug for Deque<T, I>
where T: Debug, I: Debug + Offset,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T, I> Default for Deque<T, I>
where I: Offset,

Source§

fn default() -> Deque<T, I>

Returns the “default value” for a type. Read more
Source§

impl<T, I> Extend<T> for Deque<T, I>
where I: Offset,

Source§

fn extend<X>(&mut self, iter: X)
where X: IntoIterator<Item = T>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T, I> FromIterator<T> for Deque<T, I>
where I: Offset,

Source§

fn from_iter<X>(iter: X) -> Deque<T, I>
where X: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
Source§

impl<T, I> Hash for Deque<T, I>
where T: Hash, I: Hash + Offset,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, I> Index<I> for Deque<T, I>
where I: Offset,

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, i: I) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T, I> IndexMut<I> for Deque<T, I>
where I: Offset,

Source§

fn index_mut(&mut self, i: I) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'v, T, I> IntoIterator for &'v Deque<T, I>
where I: Offset,

Source§

type Item = (I, &'v T)

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'v, T, I>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Iter<'v, T, I>

Creates an iterator from a value. Read more
Source§

impl<'v, T, I> IntoIterator for &'v mut Deque<T, I>
where I: Offset,

Source§

type Item = (I, &'v mut T)

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'v, T, I>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> IterMut<'v, T, I>

Creates an iterator from a value. Read more
Source§

impl<T, I> IntoIterator for Deque<T, I>
where I: Offset,

Source§

type Item = (I, T)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T, I>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> IntoIter<T, I>

Creates an iterator from a value. Read more
Source§

impl<T, I> PartialEq for Deque<T, I>
where T: PartialEq, I: PartialEq + Offset,

Source§

fn eq(&self, other: &Deque<T, I>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, I> Eq for Deque<T, I>
where T: Eq, I: Eq + Offset,

Source§

impl<T, I> StructuralPartialEq for Deque<T, I>
where I: Offset,

Auto Trait Implementations§

§

impl<T, I> Freeze for Deque<T, I>
where I: Freeze,

§

impl<T, I> RefUnwindSafe for Deque<T, I>

§

impl<T, I> Send for Deque<T, I>
where I: Send, T: Send,

§

impl<T, I> Sync for Deque<T, I>
where I: Sync, T: Sync,

§

impl<T, I> Unpin for Deque<T, I>
where I: Unpin, T: Unpin,

§

impl<T, I> UnsafeUnpin for Deque<T, I>
where I: UnsafeUnpin,

§

impl<T, I> UnwindSafe for Deque<T, I>
where I: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DebugExt<T> for T
where T: Debug,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<A> DynCastExt for A

Source§

fn dyn_cast<T>( self, ) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source>
where A: DynCastExtHelper<T>, T: ?Sized,

Use this to cast from one trait object type to another. Read more
Source§

fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target
where A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>, T: ?Sized,

Use this to upcast a trait to one of its supertraits. Read more
Source§

fn dyn_cast_adv<F, T>( self, ) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source>
where A: DynCastExtAdvHelper<F, T>, F: ?Sized, T: ?Sized,

Use this to cast from one trait object type to another. This method is more customizable than the dyn_cast method. Here you can also specify the “source” trait from which the cast is defined. This can for example allow using casts from a supertrait of the current trait object. Read more
Source§

fn dyn_cast_with_config<C>( self, ) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source>

Use this to cast from one trait object type to another. With this method the type parameter is a config type that uniquely specifies which cast should be preformed. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more