This repository was archived by the owner on Jun 25, 2025. It is now read-only.
Repository navigation
v0.0.2
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);
}