fast_delegate

Crates.iofast_delegate
lib.rsfast_delegate
version0.11.0
sourcesrc
created_at2024-07-07 10:37:52.934388
updated_at2024-07-07 10:37:52.934388
descriptiondelegate struct easy
homepage
repositoryhttps://github.com/Bruce0203/delegare
max_upload_size
id1294699
size8,674
(Bruce0203)

documentation

README

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();
}
Commit count: 28

cargo fmt