Open
Description
Hi,
I am having issues constructing a mutable dictionary, maybe you could help me figure out what I am doing wrong:
static kIOPrimaryInterface: &str = "IOPrimaryInterface";
let property_dict = unsafe {
CFMutableDictionary::new(
kCFAllocatorDefault,
0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks,
)
}.unwrap();
let primary_key = unsafe { CFString::from_static_str(kIOPrimaryInterface) };
let value = unsafe { kCFBooleanTrue.unwrap() };
unsafe { property_dict.set(primary_key, value) };
Errors with:
34 | unsafe { property_dict.set(primary_key, value) };
| ^^^ ----- expected `&Opaque`, found `&CFBoolean`
note: expected `&Opaque`, found `CFRetained<CFString>`
34 | unsafe { property_dict.set(primary_key, value) };
| ^^^^^^^^^^^
= note: expected reference `&objc2_core_foundation::opaque::Opaque`
found struct `CFRetained<CFString>`
= note: expected reference `&objc2_core_foundation::opaque::Opaque`
found reference `&CFBoolean`