Macro indexed::extrusive_indexed[][src]

macro_rules! extrusive_indexed {
    ($vis:vis $outer:ident { inner: $inner:ty }) => { ... };
}

Defines a wrapper type of a given type and implements Indexed for the wrapper.

The wrapped data can be accessed via inner field.

Examples

#[macro_use] extern crate indexed;
use indexed::{Indexed,Pool};

extrusive_indexed!{ Foo{ inner: i32 }}

let mut pool = pool!( Foo[
    Foo::from( 0 ),
    Foo::from( 1 ),
    Foo::from( 2 ),
]);

pool.iter_mut().for_each( |foo| foo.inner += 10 );
assert_eq!( pool.iter().map( |e| e.inner ).collect::<Vec<_>>(), vec![ 10, 11, 12 ]);