small_derive_deref
This crate adds #[derive(Deref)] #[derive(DerefMut].
It works for:
- Structs with one field
- Structs with multiple fields
- Need
#[DerefTarget]/#[DerefMutTarget].
- Need
- Tuples with one field
- Tuples with multiple fields
- Will use the first field
Known Limitations
- The type of the fields for
#[DerefTarget]and#[DerefMutTarget]must be the same
Examples
use DerefMut;
use ;
let mut w = WrapperStructDifferentTargetsMultipleGenerics ;
assert_eq!;
*w = "rUst";
assert_eq!;
;
let mut w = WrapperTuple;
*w *= 2;
assert_eq!;
assert_eq!;
License
MIT or Apache-2.0