Macro indexed::pool

source ·
macro_rules! pool {
    ( $ty:ty[ $($x:expr),* ] ) => { ... };
    ( $ty:ty[ $($x:expr,)* ] ) => { ... };
}
Expand description

Creates a Pool containing the arguments. The element type of the pool must be given explicitly inside the macro, of which the arguments is able to be converted into.

The wrapped data can be accessed via inner field.

Examples

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

extrusive_indexed!{ Foo{ inner: &'static str }}

let mut pool = pool!( Foo[ "a", "b", "c" ]);

assert_eq!( pool[0].inner, "a" );
assert_eq!( pool[1].inner, "b" );
assert_eq!( pool[2].inner, "c" );