Expand description
This library provides some utility traits to make working with Any
smoother.
This crate contains similiar functionality to the downcast
crate, but simpler,
e.g. it isn’t necessary to call some macro to instantiate the downcast methods.
§Usage example
use as_any::{AsAny, Downcast};
struct Test;
trait Custom: AsAny {
// whatever you like to put inside of your trait
}
impl Custom for Test {}
fn lol() {
let x = Test;
let y: &dyn Custom = &x;
// With (extension) trait `Downcast` in scope.
y.downcast_ref::<Test>().unwrap();
}