pub trait VecLike {
type Elem;
type ElemRef<'a>
where Self: 'a;
type Slice: ?Sized + Slice;
type Collection: FromIterator<Self::Elem>;
type Drain<'a>: Iterator<Item = Self::Elem>
where Self: 'a;
Show 22 methods
// Required methods
fn as_slice(&self) -> &Self::Slice;
fn as_mut_slice(&mut self) -> &mut Self::Slice;
fn as_mut_collection(&mut self) -> &mut Self::Collection;
fn capacity(&self) -> usize;
fn truncate(&mut self, len: usize);
fn insert(&mut self, index: usize, element: Self::Elem);
fn remove(&mut self, index: usize) -> Self::Elem;
fn push(&mut self, value: Self::Elem);
fn pop(&mut self) -> Option<Self::Elem>;
fn append(&mut self, other: &mut Self::Collection);
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>
where R: RangeBounds<usize>;
fn clear(&mut self);
fn len(&self) -> usize;
fn is_empty(&self) -> bool;
fn resize(&mut self, new_len: usize, value: Self::Elem)
where Self::Elem: Clone;
fn resize_with<F>(&mut self, new_len: usize, f: F)
where F: FnMut() -> Self::Elem;
fn retain<F>(&mut self, f: F)
where F: FnMut(Self::ElemRef<'_>) -> bool;
// Provided methods
fn reserve(&mut self, additional: usize) { ... }
fn reserve_exact(&mut self, additional: usize) { ... }
fn shrink_to_fit(&mut self) { ... }
fn shrink_to(&mut self, min_capacity: usize) { ... }
fn split_off(&mut self, at: usize) -> Self::Collection { ... }
}Required Associated Types§
type Elem
type ElemRef<'a> where Self: 'a
type Slice: ?Sized + Slice
type Collection: FromIterator<Self::Elem>
type Drain<'a>: Iterator<Item = Self::Elem> where Self: 'a
Required Methods§
fn as_slice(&self) -> &Self::Slice
fn as_mut_slice(&mut self) -> &mut Self::Slice
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn truncate(&mut self, len: usize)
fn insert(&mut self, index: usize, element: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn push(&mut self, value: Self::Elem)
fn pop(&mut self) -> Option<Self::Elem>
fn append(&mut self, other: &mut Self::Collection)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn retain<F>(&mut self, f: F)
Provided Methods§
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to_fit(&mut self)
fn shrink_to(&mut self, min_capacity: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl VecLike for String
impl VecLike for String
type Elem = char
type ElemRef<'a> = char where Self: 'a
type Slice = str
type Collection = String
type Drain<'a> = Drain<'a>
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &Self::Slice
fn as_mut_slice(&mut self) -> &mut Self::Slice
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, ch: Self::Elem)
fn remove(&mut self, idx: usize) -> Self::Elem
fn insert(&mut self, idx: usize, ch: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, new_len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<A: Array> VecLike for SmallVec<A>
Available on crate feature smallvec only.
impl<A: Array> VecLike for SmallVec<A>
Available on crate feature
smallvec only.type Elem = <A as Array>::Item
type ElemRef<'a> = &'a <A as Array>::Item where Self: 'a
type Slice = [<A as Array>::Item]
type Collection = SmallVec<A>
type Drain<'a> = Drain<'a, A> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &[Self::Elem]
fn as_mut_slice(&mut self) -> &mut [Self::Elem]
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<A: Array<Item = u8>> VecLike for SmallString<A>
Available on crate feature smallstr only.
impl<A: Array<Item = u8>> VecLike for SmallString<A>
Available on crate feature
smallstr only.type Elem = char
type ElemRef<'a> = char where Self: 'a
type Slice = str
type Collection = SmallString<A>
type Drain<'a> = DrainRange<'a, A> where A: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &Self::Slice
fn as_mut_slice(&mut self) -> &mut Self::Slice
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, ch: Self::Elem)
fn remove(&mut self, idx: usize) -> Self::Elem
fn insert(&mut self, idx: usize, ch: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, new_len: usize)
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<S> VecLike for Cow<'_, S>
impl<S> VecLike for Cow<'_, S>
type Elem = <<S as ToOwned>::Owned as VecLike>::Elem
type ElemRef<'a> = <<S as ToOwned>::Owned as VecLike>::ElemRef<'a> where Self: 'a
type Slice = <<S as ToOwned>::Owned as VecLike>::Slice
type Collection = <<S as ToOwned>::Owned as VecLike>::Collection
type Drain<'a> = <<S as ToOwned>::Owned as VecLike>::Drain<'a> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &Self::Slice
fn as_mut_slice(&mut self) -> &mut Self::Slice
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<T> VecLike for Vec<T>
impl<T> VecLike for Vec<T>
type Elem = T
type ElemRef<'a> = &'a T where Self: 'a
type Slice = [T]
type Collection = Vec<T>
type Drain<'a> = Drain<'a, T> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &[Self::Elem]
fn as_mut_slice(&mut self) -> &mut [Self::Elem]
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<T> VecLike for ArcVec<T>
Available on crate feature rc-vec only.
impl<T> VecLike for ArcVec<T>
Available on crate feature
rc-vec only.type Elem = T
type ElemRef<'a> = &'a T where Self: 'a
type Slice = [T]
type Collection = ArcVec<T>
type Drain<'a> = ArcVecDrain<'a, T> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &[Self::Elem]
fn as_mut_slice(&mut self) -> &mut [Self::Elem]
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<T> VecLike for RcVec<T>
Available on crate feature rc-vec only.
impl<T> VecLike for RcVec<T>
Available on crate feature
rc-vec only.type Elem = T
type ElemRef<'a> = &'a T where Self: 'a
type Slice = [T]
type Collection = RcVec<T>
type Drain<'a> = RcVecDrain<'a, T> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &[Self::Elem]
fn as_mut_slice(&mut self) -> &mut [Self::Elem]
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<V: VecLike + Clone> VecLike for Rc<V>
impl<V: VecLike + Clone> VecLike for Rc<V>
type Elem = <V as VecLike>::Elem
type ElemRef<'a> = <V as VecLike>::ElemRef<'a> where Self: 'a
type Slice = <V as VecLike>::Slice
type Collection = <V as VecLike>::Collection
type Drain<'a> = <V as VecLike>::Drain<'a> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &Self::Slice
fn as_mut_slice(&mut self) -> &mut Self::Slice
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<V: VecLike + Clone> VecLike for Arc<V>
impl<V: VecLike + Clone> VecLike for Arc<V>
type Elem = <V as VecLike>::Elem
type ElemRef<'a> = <V as VecLike>::ElemRef<'a> where Self: 'a
type Slice = <V as VecLike>::Slice
type Collection = <V as VecLike>::Collection
type Drain<'a> = <V as VecLike>::Drain<'a> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &Self::Slice
fn as_mut_slice(&mut self) -> &mut Self::Slice
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<V: VecLike> VecLike for &mut V
impl<V: VecLike> VecLike for &mut V
type Elem = <V as VecLike>::Elem
type ElemRef<'a> = <V as VecLike>::ElemRef<'a> where Self: 'a
type Slice = <V as VecLike>::Slice
type Collection = <V as VecLike>::Collection
type Drain<'a> = <V as VecLike>::Drain<'a> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &Self::Slice
fn as_mut_slice(&mut self) -> &mut Self::Slice
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<V: VecLike> VecLike for Box<V>
impl<V: VecLike> VecLike for Box<V>
type Elem = <V as VecLike>::Elem
type ElemRef<'a> = <V as VecLike>::ElemRef<'a> where Self: 'a
type Slice = <V as VecLike>::Slice
type Collection = <V as VecLike>::Collection
type Drain<'a> = <V as VecLike>::Drain<'a> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &Self::Slice
fn as_mut_slice(&mut self) -> &mut Self::Slice
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<V: VecLike> VecLike for UniqArc<V>
Available on crate feature unique-rc only.
impl<V: VecLike> VecLike for UniqArc<V>
Available on crate feature
unique-rc only.type Elem = <V as VecLike>::Elem
type ElemRef<'a> = <V as VecLike>::ElemRef<'a> where Self: 'a
type Slice = <V as VecLike>::Slice
type Collection = <V as VecLike>::Collection
type Drain<'a> = <V as VecLike>::Drain<'a> where Self: 'a
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn as_slice(&self) -> &Self::Slice
fn as_mut_slice(&mut self) -> &mut Self::Slice
fn as_mut_collection(&mut self) -> &mut Self::Collection
fn capacity(&self) -> usize
fn pop(&mut self) -> Option<Self::Elem>
fn push(&mut self, value: Self::Elem)
fn remove(&mut self, index: usize) -> Self::Elem
fn insert(&mut self, index: usize, element: Self::Elem)
fn reserve(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
fn shrink_to(&mut self, min_capacity: usize)
fn shrink_to_fit(&mut self)
fn truncate(&mut self, len: usize)
fn split_off(&mut self, at: usize) -> Self::Collection
fn resize(&mut self, new_len: usize, value: Self::Elem)
fn resize_with<F>(&mut self, new_len: usize, f: F)
fn drain<R>(&mut self, range: R) -> Self::Drain<'_>where
R: RangeBounds<usize>,
fn clear(&mut self)
fn append(&mut self, other: &mut Self::Collection)
fn retain<F>(&mut self, f: F)
Source§impl<V: VecLike> VecLike for UniqRc<V>
Available on crate feature unique-rc only.
impl<V: VecLike> VecLike for UniqRc<V>
Available on crate feature
unique-rc only.