Derive Macro fundamental_data_type::DerefMut

source ·
#[derive(DerefMut)]
Expand description

Derive macro to implement Deref when-ever it’s possible to do automatically.

§Sample :: struct instead of macro.

Write this

#[ derive( Deref, DerefMut ) ]
pub struct IsTransparent( bool );

Instead of this

pub struct IsTransparent( bool );
impl core::ops::Deref for IsTransparent
{
  type Target = bool;
  #[ inline( always ) ]
  fn deref( &self ) -> &Self::Target
  {
    &self.0
  }
}
impl core::ops::DerefMut for IsTransparent
{
  #[ inline( always ) ]
  fn deref_mut( &mut self ) -> &mut Self::Target
  {
    &mut self.0
  }
}