This library is a slightly more convenient version of derive_more
.
```rust
struct Target(Base); ```
text
Derive := <Trait> | <Trait>(via = <Type>)
In this example, the Inner
does not derive the Eq
or Display
,
but Outer
derives them through the i32
.
```rust use deriving_via::DerivingVia;
pub struct Inner(i32);
pub struct Outer(Inner);
fn main() { let x = Outer(Inner(42)); let y = Outer(Inner(42));
println!("{x} == {y} => {}", x == y);
// 42 == 42 => true
} ```
```rust struct Base(Underlying);
struct Target(Base); ```
Base: Into<Underlying>
Base: From<Underlying>
Base: From<Underlying>
Base: From<Underlying>