Skip to main content

Deref

Derive Macro Deref 

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

Implement Deref for a structure.

ยงSample.

use derive_tools::Deref;

#[ derive( Deref ) ]
struct MyStruct
{
  #[ deref ]
  a: i32,
  b: i32,
}

let my_struct = MyStruct { a: 1, b: 2 };
dbg!( *my_struct );

To learn more about the feature, study the module derive_tools::Deref.