Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

v0.0.2

Choose a tag to compare

@not-elm not-elm released this 20 May 10:49
· 46 commits to master since this release

Supported New-Type Pattern

Example are as follows

#[delegate]
pub trait Calc {
    fn calc(&self, x1: usize, x2: usize) -> usize;
}


#[derive(Default)]
pub struct Child;


impl Calc for Child {
    fn calc(&self, x1: usize, x2: usize) -> usize {
        x1 + x2
    }
}


#[derive(Delegate, Default)]
#[to(Calc)]
pub struct Parent(Child);


fn main() {
    let mut parent = Parent::default();

    assert_eq!(parent.calc(2, 3), 5);
}