[−][src]Trait typic::Transparent
Indicates a type has no internal validity requirements.
The Transparent
trait is used to indicate that a compound type does not
place any additional validity restrictions on its fields.
This trait can be implemented manually:
#[typic::repr(C)] pub struct Unconstrained { wizz: u8, bang: i8, } unsafe impl Transparent for Unconstrained {} let _ : Unconstrained = u16::default().transmute_into();
Or, automatically, by marking the fields pub
:
#[typic::repr(C)] pub struct Unconstrained { pub wizz: u8, pub bang: i8, } let _ : Unconstrained = u16::default().transmute_into();
If the fields are marked pub
, the type cannot rely on any internal
validity requirements, as users of the type are free to manipulate its
fields via the .
operator.