Crates.io | fast_delegate_derive |
lib.rs | fast_delegate_derive |
version | 0.13.0 |
source | src |
created_at | 2024-07-07 10:37:44.186839 |
updated_at | 2024-07-24 01:49:48.399388 |
description | delegate struct easy |
homepage | |
repository | https://github.com/Bruce0203/delegare |
max_upload_size | |
id | 1294698 |
size | 9,807 |
fast_delegate
Pros
auto_delegate
cratedeleagate
crateCons
#[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();
}