AsMut

Derive Macro AsMut 

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

Implement AsMut for a structure.

ยงSample.

use derive_tools::AsMut;

#[ derive( AsMut ) ]
struct MyStruct
{
  #[ as_mut( original ) ]
  a: i32,
  b: i32,
}

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

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