Attribute Macro pipewire_wrapper_proc_macro::object_type_impl
source · #[object_type_impl]
Expand description
Add an *Info and *Builder structures after the enum definition. For each enum variant will be added optional struct fields with value and flags.
Examples
Derive:
ⓘ
#[allow(non_camel_case_types)]
#[derive(Debug)]
#[repr(u32)]
#[object_info(OBJECT_PROPS)]
pub enum ObjectPropType<'a> {
// Device
DEVICE(&'a PodStringRef) = Prop::DEVICE.raw,
DEVICE_NAME(&'a PodStringRef) = Prop::DEVICE_NAME.raw,
}
Usage:
ⓘ
if let Ok(BasicType::OBJECT(object)) = param.downcast() {
match object.body_type() {
Type::OBJECT_PROP_INFO => {
let info = ObjectPropInfoInfo::try_from(object).unwrap();
println!("Prop info: {:?}", info);
}
_ => todo!(),
}
}