Derive Macro Deref

Source
#[derive(Deref)]
{
    // Attributes available to this derive:
    #[debug]
}
Expand description

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

§Sample :: struct instead of macro.

Write this

#[ derive( Deref ) ]
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
  }
}