[−][src]Attribute Macro heim_derive::os_ext_for
#[os_ext_for]
Augument OS-specific trait with boilerplate-generation.
Automatically implements this trait for target struct, generates all opaque methods and attaches #[cfg()] attribute.
Should be used as following:
#[heim_derive::os_ext_for(crate::CpuTimes, cfg(target_os = "linux"))]
pub trait CpuTimesExt {
fn foo(&self) -> u32;
}
Will generate the code similar to following:
pub trait CpuTimesExt {
fn foo(&self) -> u32;
}
#[cfg(target_os = "linux")
impl CpuTimesExt for crate::CpuTimes {
fn foo(&self) -> u32 {
self.as_ref().foo()
}
}