ref-cast 1.0.25

Safely cast &T to &U where the struct U contains a single field of type T.
Documentation
use ref_cast::{ref_cast_custom, RefCast, RefCastCustom};

#[derive(RefCast, RefCastCustom)]
#[repr(transparent)]
pub struct Public {
    private: Private,
}

struct Private;

impl Public {
    #[ref_cast_custom]
    fn ref_cast(private: &Private) -> &Public;

    #[ref_cast_custom]
    fn ref_cast_mut(private: &mut Private) -> &mut Public;
}

fn main() {}