# reflica
Automatically implements `Deref` / `DerefMut` / `AsRef` / `AsMut` from the given `deref` / `deref_mut`.
[](https://crates.io/crates/reflica)
[](https://docs.rs/reflica/latest/reflica)
[](https://github.com/kimhappy/reflica/blob/main/LICENSE)
## Example
```rust
struct Wrapper {
value: String,
}
#[reflica::reflica]
impl Wrapper {
type Target = String;
pub fn new(value: String) -> Self {
Self { value }
}
fn deref(&self) -> &Self::Target {
&self.value
}
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.value
}
}
let mut wrapper = Wrapper::new("Hello".into());
let as_ref: &str = wrapper.as_ref();
assert_eq!(as_ref, "Hello");
let as_mut: &mut String = wrapper.as_mut();
as_mut.push_str(", world!");
assert_eq!(*as_mut, "Hello, world!");
```