3 releases (breaking)

0.13.0 Jul 24, 2024
0.12.0 Jul 21, 2024
0.11.0 Jul 7, 2024

#5 in #delegate

Download history 70/week @ 2024-07-15 181/week @ 2024-07-22 55/week @ 2024-07-29 19/week @ 2024-09-16 5/week @ 2024-09-23

123 downloads per month

MIT license

5KB

fast_delegate

Pros

  • Faster than auto_delegate crate
  • Easier than deleagate crate

Cons

example of this crate

#[delegate]
pub trait Read {
    fn read(&self) -> &usize;
}

#[derive(Delegate)]
struct Wrapper<R>
where
    R: Read,
{
    #[to(Read)]
    inner: R,
}

struct Io {
    value: usize,
}

impl Read for Io {
    fn read(&self) -> &usize {
        &self.value
    }
}

fn main() {
    let wrapper = Wrapper {
        inner: Io { value: 1 },
    };
    wrapper.read();
}

Dependencies

~255–710KB
~17K SLoC