client-toolkit
client-toolkit copied to clipboard
delegate macros as attributes
For now for implementing a certain feature, one need to implement trait, then call a delegate_<feat>! on the structure which seems a little bit redundant, so instead of this:
impl<T: Xyz + 'static> ShmHandler for SimpleWindow<T> {
fn shm_state(&mut self) -> &mut Shm {
&mut self.shm
}
}
delegate_shm!(@<T: Xyz + 'static> SimpleWindow<T>);
it would be nice to have this instead:
#[sctk::delegate]
impl<T: Xyz + 'static> ShmHandler for SimpleWindow<T> {
fn shm_state(&mut self) -> &mut Shm {
&mut self.shm
}
}