CollectionMut

Trait CollectionMut 

Source
pub trait CollectionMut: Collection {
    type ItemMut<'a>: DerefMut<Target = Self::Item>
       where Self: 'a;

    // Required method
    fn upcast_item_mut<'short, 'long: 'short>(
        r: Self::ItemMut<'long>,
    ) -> Self::ItemMut<'short>
       where Self: 'long;
}
Expand description

Abstract collection that can be mutably referenced.

Required Associated Types§

Source

type ItemMut<'a>: DerefMut<Target = Self::Item> where Self: 'a

Type of mutable references to items of the collection.

Required Methods§

Source

fn upcast_item_mut<'short, 'long: 'short>( r: Self::ItemMut<'long>, ) -> Self::ItemMut<'short>
where Self: 'long,

Changes an item mutable reference into a shorter lived mutable reference.

See the CollectionRef::upcast_item_ref function for more information. You can use the covariant_item_mut! macro to automatically implement this function.

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<K, V> CollectionMut for BTreeMap<K, V>

Source§

type ItemMut<'a> = &'a mut V where Self: 'a

Source§

fn upcast_item_mut<'short, 'long: 'short>( r: Self::ItemMut<'long>, ) -> Self::ItemMut<'short>
where Self: 'long,

Source§

impl<K, V> CollectionMut for HashMap<K, V>

Source§

type ItemMut<'a> = &'a mut V where Self: 'a

Source§

fn upcast_item_mut<'short, 'long: 'short>( r: Self::ItemMut<'long>, ) -> Self::ItemMut<'short>
where Self: 'long,

Source§

impl<T> CollectionMut for BTreeSet<T>

Source§

type ItemMut<'a> = &'a mut T where Self: 'a

Source§

fn upcast_item_mut<'short, 'long: 'short>( r: Self::ItemMut<'long>, ) -> Self::ItemMut<'short>
where Self: 'long,

Source§

impl<T> CollectionMut for VecDeque<T>

Source§

type ItemMut<'a> = &'a mut T where Self: 'a

Source§

fn upcast_item_mut<'short, 'long: 'short>( r: Self::ItemMut<'long>, ) -> Self::ItemMut<'short>
where Self: 'long,

Source§

impl<T> CollectionMut for Vec<T>

Source§

type ItemMut<'a> = &'a mut T where Self: 'a

Source§

fn upcast_item_mut<'short, 'long: 'short>( r: Self::ItemMut<'long>, ) -> Self::ItemMut<'short>
where Self: 'long,

Source§

impl<T> CollectionMut for HashSet<T>

Source§

type ItemMut<'a> = &'a mut T where Self: 'a

Source§

fn upcast_item_mut<'short, 'long: 'short>( r: Self::ItemMut<'long>, ) -> Self::ItemMut<'short>
where Self: 'long,

Implementors§