Implement ConcreteCFType for CFDictionary<*void, *void>

This commit is contained in:
Linus Färnstrand
2018-10-23 09:38:35 +02:00
parent 1dd66bd610
commit 8ca2746589
+3
View File
@@ -19,6 +19,7 @@ use std::marker::PhantomData;
use base::{ItemRef, FromVoid, ToVoid};
use base::{CFIndexConvertible, TCFType};
use ConcreteCFType;
// consume the type parameters with PhantomDatas
pub struct CFDictionary<K = *const c_void, V = *const c_void>(CFDictionaryRef, PhantomData<K>, PhantomData<V>);
@@ -32,6 +33,8 @@ impl<K, V> Drop for CFDictionary<K, V> {
impl_TCFType!(CFDictionary<K, V>, CFDictionaryRef, CFDictionaryGetTypeID);
impl_CFTypeDescription!(CFDictionary);
unsafe impl ConcreteCFType for CFDictionary<*const c_void, *const c_void> {}
impl<K, V> CFDictionary<K, V> {
pub fn from_CFType_pairs(pairs: &[(K, V)]) -> CFDictionary<K, V> where K: TCFType, V: TCFType {
let (keys, values): (Vec<CFTypeRef>, Vec<CFTypeRef>) = pairs