upcast

Crates.ioupcast
lib.rsupcast
version0.1.0
sourcesrc
created_at2019-08-09 21:56:44.788855
updated_at2019-08-09 21:56:44.788855
descriptionSimple trait for helping along upcasting of dyn supertraits. ``` pub trait A {} pub trait B: A + Upcast {} // Put this in your library impl<'a, T: A + 'a> UpcastFrom for dyn A + 'a { fn up_from(value: &T) -> &(dyn A + 'a) { value } fn up_from_mut(value: &mut T) -> &mut (dyn A + 'a) { value } } // Now your users can do an upcast if needed, or you can within implementations fn do_cast(b: &dyn B) -> &dyn A { b.up() } ```
homepage
repositoryhttps://github.com/connicpu/upcast
max_upload_size
id155477
size3,151
Connie Hilarides (Connicpu)

documentation

README

Commit count: 1

cargo fmt