Skip to main content

Collection

Trait Collection 

Source
pub trait Collection
where (): EmptyState<(), Self>,
{ type Item; type RefIter<'a>: ExactSizeIterator<Item = &'a Self::Item> where Self::Item: 'a, Self: 'a; type ReverseIter<'a>: Iterator<Item = &'a Self::Item> where Self::Item: 'a, Self: 'a; // Required methods fn len(&self) -> usize; fn iter(&self) -> Self::RefIter<'_>; fn reversed(&self) -> Self::ReverseIter<'_>; fn insert(&mut self, item: Self::Item) -> Result<(), DecodeErrorKind>; }
Expand description

Trait for containers that store multiple items such as Vec, BTreeSet, and HashSet

Required Associated Types§

Source

type Item

Source

type RefIter<'a>: ExactSizeIterator<Item = &'a Self::Item> where Self::Item: 'a, Self: 'a

Source

type ReverseIter<'a>: Iterator<Item = &'a Self::Item> where Self::Item: 'a, Self: 'a

Required Methods§

Source

fn len(&self) -> usize

Source

fn iter(&self) -> Self::RefIter<'_>

Source

fn reversed(&self) -> Self::ReverseIter<'_>

Source

fn insert(&mut self, item: Self::Item) -> Result<(), DecodeErrorKind>

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<T> Collection for Cow<'_, [T]>
where T: Clone,

Source§

type Item = T

Source§

type RefIter<'a> = Iter<'a, T> where T: 'a, Self: 'a

Source§

type ReverseIter<'a> = Rev<Iter<'a, T>> where Self::Item: 'a, Self: 'a

Source§

fn len(&self) -> usize

Source§

fn iter(&self) -> Self::RefIter<'_>

Source§

fn reversed(&self) -> Self::ReverseIter<'_>

Source§

fn insert(&mut self, item: Self::Item) -> Result<(), DecodeErrorKind>

Source§

impl<T> Collection for BTreeSet<T>
where T: Ord,

Source§

type Item = T

Source§

type RefIter<'a> = Iter<'a, T> where Self::Item: 'a, Self: 'a

Source§

type ReverseIter<'a> = Rev<Iter<'a, T>> where Self::Item: 'a, Self: 'a

Source§

fn len(&self) -> usize

Source§

fn iter(&self) -> Self::RefIter<'_>

Source§

fn reversed(&self) -> Self::ReverseIter<'_>

Source§

fn insert(&mut self, item: Self::Item) -> Result<(), DecodeErrorKind>

Source§

impl<T> Collection for Vec<T>

Source§

type Item = T

Source§

type RefIter<'a> = Iter<'a, T> where T: 'a, Self: 'a

Source§

type ReverseIter<'a> = Rev<Iter<'a, T>> where Self::Item: 'a, Self: 'a

Source§

fn len(&self) -> usize

Source§

fn iter(&self) -> Self::RefIter<'_>

Source§

fn reversed(&self) -> Self::ReverseIter<'_>

Source§

fn insert(&mut self, item: T) -> Result<(), DecodeErrorKind>

Source§

impl<T, S> Collection for HashSet<T, S>
where T: Eq + Hash, S: Default + BuildHasher,

Source§

type Item = T

Source§

type RefIter<'a> = Iter<'a, T> where Self::Item: 'a, Self: 'a

Source§

type ReverseIter<'a> = <HashSet<T, S> as Collection>::RefIter<'a> where Self::Item: 'a, Self: 'a

Source§

fn len(&self) -> usize

Source§

fn iter(&self) -> Self::RefIter<'_>

Source§

fn reversed(&self) -> Self::ReverseIter<'_>

Source§

fn insert(&mut self, item: Self::Item) -> Result<(), DecodeErrorKind>

Implementors§