[−][src]Macro restor::make_storage
Shorthand for forming storage with preallocated types.
It will also wrap it in an Arc
(More below)
Usage
The syntax for the macro is as follows:
make_storage!(StorageType); // -> StorageType make_storage!(Arc StorageType); // -> Arc<StorageType> make_storage!(StorageType: String, usize, isize, i32, OtherTypes); // -> StorageType with types preallocated make_storage!(Arc StorageType: String, usize, isize, i32, OtherTypes); // -> StorageType with types preallocated
Example
use restor::{DynamicStorage, make_storage}; let x: DynamicStorage = make_storage!(DynamicStorage: usize, String, isize); x.insert(0usize).unwrap(); x.insert(String::new()).unwrap();
Arc Example
use restor::{RwLockStorage, make_storage}; let x = make_storage!(Arc RwLockStorage: usize, String); let nx = x.clone(); std::thread::spawn( move || { nx.insert(String::new()).unwrap(); }); x.insert(0usize);