Derive Macro fundamental_data_type::AsRef
source · #[derive(AsRef)]
Expand description
Derive macro to implement AsRef when-ever it’s possible to do automatically.
§Sample :: struct instead of macro.
Write this
#[ derive( AsRef ) ]
pub struct IsTransparent( bool );
Instead of this
pub struct IsTransparent( bool );
impl AsRef< bool > for IsTransparent
{
fn as_ref( &self ) -> &bool
{
&self.0
}
}