# easy_deref
Derive macros for the `Deref` and `DerefMut` traits that support multi-field structs.
# Example
```rust,ignore
use easy_deref::{Deref, DerefMut};
#[derive(Deref, DerefMut)]
struct Newtype(u32); // Automatically dereferences to `u32`
let nt = Newtype(13);
assert_eq!(*nt, 13);
#[derive(Deref, DerefMut)]
struct<'a, T> ComplexStruct {
msg: &'a str,
#[deref] // Dereferences to `data`
data: Vec<T>,
}
let value = ComplexStruct { msg: "Hello, World!", data: vec![1, 2, 3] };
assert_eq!(*value, vec![1, 2, 3]);
*value = vec![4, 5, 6];
assert_eq!(*value, vec![4, 5, 6]);
```
# License
Licensed under either:
- [MIT License](LICENSE-MIT), or
- [Apache License, Version 2.0](LICENSE-APACHE),
at your option.
# Why use easy_deref
With many crates for deriving the `Deref` and `DerefMut` traits available, you might be wondering, why use `easy_deref`?
`easy_deref` is the only crate that allows you to **select** a field to dereference, allowing support for multi-field structs.