Trait ref_cast::RefCast [−][src]
Safely cast &T to &U where the struct U contains a single field of
type T.
// `&String` can be cast to `&U`. #[derive(RefCast)] #[repr(transparent)] struct U(String); // `&T` can be cast to `&V<T>`. #[derive(RefCast)] #[repr(transparent)] struct V<T> { t: T, }
See the crate-level documentation for usage examples!