pub struct Dict<T> { /* private fields */ }
Implementations§
Source§impl<T> Dict<T>
WIP: not fully functionnal/practical
there is a way of getting a type name with std::any::type_name::<T>()
which returns "T" as &str
with a macro we can get the reversed processus by parsing the "T"
inside downcast_ref::<T>()
allowing a behavior such as let value = dict.get!(my_key).unwrap();
, which could be simplified as
let value = dict[my_key]
, instead of let value: &T = dict.get::<T>(my_key).unwrap();
.unwrap()
is needed as it is the responsibility of the coder to handle missbehavior of the dict usage
impl<T> Dict<T>
WIP: not fully functionnal/practical
there is a way of getting a type name with std::any::type_name::<T>()
which returns "T" as &str
with a macro we can get the reversed processus by parsing the "T"
inside downcast_ref::<T>()
allowing a behavior such as let value = dict.get!(my_key).unwrap();
, which could be simplified as
let value = dict[my_key]
, instead of let value: &T = dict.get::<T>(my_key).unwrap();
.unwrap()
is needed as it is the responsibility of the coder to handle missbehavior of the dict usage
§Example of current usage
let mut my_dict = Dict::new();
my_dict.insert("key", "value");
println!("{}", my_dict.get::<&str>("key").unwrap());
Auto Trait Implementations§
impl<T> Freeze for Dict<T>
impl<T> !RefUnwindSafe for Dict<T>
impl<T> !Send for Dict<T>
impl<T> !Sync for Dict<T>
impl<T> Unpin for Dict<T>where
T: Unpin,
impl<T> !UnwindSafe for Dict<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more