macro_rules! auto_impl { ( #[derived_from(ReadIntoUninit)] impl $( [$($generics:tt)*] )? Read for $T:ty $( where $($where_clause:tt)* )? ) => { ... }; }
Available on crate feature
std
only.Expand description
Helper macro to alleviate the code duplication from implementing both
Read
and ReadIntoUninit
.
Once some type T
implements ReadIntoUninit
, you can derive Read
by
doing:
::uninit::read::auto_impl! {
#[derived_from(ReadIntoUninit)]
impl Read for X
}
// and if X is generic, over, for instance, `Generics`
::uninit::read::auto_impl! {
#[derived_from(ReadIntoUninit)]
impl[Generics] Read for X<Generics>
}