[−][src]Crate restor
A dynamically allocated storage system. Check it out on Github, or its capabilities on the
tests. This is meant to serve as a storage solution for resources in a dynamic context. It
supports runtime borrow checking using RefCell
s. It will support a concurrent context in
the future.
Example
let mut storage = DynamicStorage::new(); storage.allocate_for::<usize>(); storage.allocate_for::<String>(); storage.insert::<String>("abc".into()); let mut my_string = storage.get::<&mut String>().unwrap(); storage.insert_many::<usize>(vec![2, 4, 8, 16, 32]); for i in storage.get::<&[usize]>().unwrap().iter() { *my_string = format!("{}, {:?}", &*my_string, i); } assert_eq!("abc, 2, 4, 8, 16, 32", &*my_string);
Macros
err | A shorthand for unwrapping a |
make_storage | Shorthand for forming storage with preallocated types.
It will also wrap it in an |
ok | A shorthand for unwrapping a |
Structs
BlackBox | The base structure for this library, contains all of the dynamically typed storage units |
DynamicStorage | The newtype for storage with interior mutability based on
|
MutexStorage | The storage with interior mutability based on |
RwLockStorage | A wrapper for a |
Enums
ErrorDesc | The basic error descriptions for why a dynamically typed resource operation didn't work. It does
not contain however, the description for unit-related errors which handled with a |
UnitError | Miscellaneous errors pertaining to the internal |
Traits
Fetch | The base "get" trait for acquiring data from storage. This is implemented on six types, each of which have a different output. The output is dependent on the type it is being implemented for. |
FetchMultiple | An abstraction over |
Unit | The type erasure trait for |