restor

A dyamic resource storage written in rust. It supports storage of multiple types and multiple entries and dynamic borrow checking with the help of RefCells, Mutexs and RwLocks from parking_lot.

Example:

```rust use restor::{DynamicStorage, make_storage};

fn main() { let x = makestorage!(DynamicStorage: usize, String); x.insertmany(vec![2usize; 20]).unwrap(); x.insert("abc".tostring()).unwrap(); let mut mystring = x.getmut::().unwrap(); x.run_for::(move |res| { for i in res.unwrap() { mystring = format!("{}, {}", &mystring, i); } None }); println!("{}", &*x.get::().unwrap()); } ```

How it works:

BlackBox (Or DynamicStorage) is defined as so (More or less): rust struct BlackBox { data: HashMap<TypeId, Box<dyn Unit>> } The Unit trait allows us to abstract over the generic type of the container (Referred to as UnitStorage in the code), so we can pass data in and out of it by using the seemingly magical Any trait. When you insert something into the storage it goes through these stages:
1. Your data in BlackBox::insert<T> 2. Boxed into a Box<dyn Any> 3. Passed to the StorageUnit as dyn Unit 4. Try to downcast as either a T or a Vec<T> 5. Put into its own place in the storage or in a Vec

What's coming up: