simple_collection_mut

Macro simple_collection_mut 

Source
macro_rules! simple_collection_mut {
    () => { ... };
}
Expand description

Automatically defines the CollectionMut::upcast_item_mut function using the covariance of the ItemMut<'a> type with regards to 'a.

ยงExample

use cc_traits::{Collection, CollectionMut, SimpleCollectionMut, covariant_item_mut, simple_collection_mut};

pub struct MyVec<T>(Vec<T>);

impl<T> Collection for MyVec<T> {
  type Item = T;
}

impl<T> CollectionMut for MyVec<T> {
  type ItemMut<'a>
  = &'a mut T where Self: 'a;

  covariant_item_mut!();
}

impl<T> SimpleCollectionMut for MyVec<T> {
  simple_collection_mut!();
}