Trait Push

Source
pub trait Push {
    type Item;
    type ItemView<'a>
       where Self: 'a;

    // Required method
    fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>;
}
Expand description

Abstracts something which can push Item into self

Required Associated Types§

Source

type Item

Item stocked in the collection

Source

type ItemView<'a> where Self: 'a

Represent a way to access Item in the collection directly after push

Required Methods§

Source

fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>

push an item into a collection, no guarantee on ordering.

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 Push for ()

Source§

type Item = ()

Source§

type ItemView<'a> = ()

Source§

fn push(&mut self, _: Self::Item) -> Self::ItemView<'_>

Source§

impl Push for String

Source§

type Item = char

Source§

type ItemView<'a> = <String as Push>::Item

Source§

fn push<'a>(&'a mut self, c: Self::Item) -> Self::ItemView<'a>

Source§

impl<Item> Push for LinkedList<Item>

Source§

type Item = Item

Source§

type ItemView<'a> = &'a mut <LinkedList<Item> as Push>::Item where Self: 'a

Source§

fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>

Source§

impl<Item> Push for VecDeque<Item>

Source§

type Item = Item

Source§

type ItemView<'a> = &'a mut <VecDeque<Item> as Push>::Item where Self: 'a

Source§

fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>

Source§

impl<Item> Push for Vec<Item>

Source§

type Item = Item

Source§

type ItemView<'a> = &'a mut <Vec<Item> as Push>::Item where Self: 'a

Source§

fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>

Source§

impl<Item, const N: usize> Push for SmallVec<[Item; N]>

Source§

type Item = Item

Source§

type ItemView<'a> = &'a mut <SmallVec<[Item; N]> as Push>::Item where Self: 'a

Source§

fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>

Source§

impl<Item: Eq + Hash, Seed: BuildHasher> Push for HashSet<Item, Seed>

Source§

type Item = Item

Source§

type ItemView<'a> = bool where Self: 'a

Source§

fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>

Source§

impl<Item: Ord> Push for BinaryHeap<Item>

Source§

type Item = Item

Source§

type ItemView<'a> = () where Self: 'a

Source§

fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>

Source§

impl<Item: Ord> Push for BTreeSet<Item>

Source§

type Item = Item

Source§

type ItemView<'a> = bool where Self: 'a

Source§

fn push(&mut self, item: Self::Item) -> Self::ItemView<'_>

Source§

impl<Key: Eq + Hash, Value, Seed: BuildHasher> Push for HashMap<Key, Value, Seed>

Source§

type Item = (Key, Value)

Source§

type ItemView<'a> = Option<Value> where Self: 'a

Source§

fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>

Source§

impl<Key: Ord, Value> Push for BTreeMap<Key, Value>

Source§

type Item = (Key, Value)

Source§

type ItemView<'a> = Option<Value> where Self: 'a

Source§

fn push<'a>(&'a mut self, item: Self::Item) -> Self::ItemView<'a>

Implementors§