This is idiomatically more correct. For example – AsRef and Deref:
let string = "hello".to_string();
// we want `AsRef<[u8]>`
let bytes: &[u8] = string.as_ref();
// we want `AsRef<str>`
let str: &str = string.as_ref();
let string = "hello".to_string();
let str = &*string; // we are given `str`
This will also make generic storing doublets than easier.
Use
Doublets<Item = T>
instead ofDoublets<T>
This is idiomatically more correct. For example –
AsRef
andDeref
:This will also make generic storing doublets than easier.