diff --git a/core-foundation/src/lib.rs b/core-foundation/src/lib.rs index 0495b7b..3b0b089 100644 --- a/core-foundation/src/lib.rs +++ b/core-foundation/src/lib.rs @@ -46,6 +46,15 @@ macro_rules! impl_TCFType { } } + impl Clone for $ty { + #[inline] + fn clone(&self) -> $ty { + unsafe { + $ty::wrap_under_get_rule(self.0) + } + } + } + impl PartialEq for $ty { #[inline] fn eq(&self, other: &$ty) -> bool { diff --git a/core-foundation/src/string.rs b/core-foundation/src/string.rs index aa7f313..0415ecd 100644 --- a/core-foundation/src/string.rs +++ b/core-foundation/src/string.rs @@ -23,15 +23,6 @@ use std::ffi::CStr; /// An immutable string in one of a variety of encodings. pub struct CFString(CFStringRef); -impl Clone for CFString { - #[inline] - fn clone(&self) -> CFString { - unsafe { - TCFType::wrap_under_get_rule(self.0) - } - } -} - impl Drop for CFString { fn drop(&mut self) { unsafe {