From 933b2359019d9e1abf468a87ca6be4e8017c8ef2 Mon Sep 17 00:00:00 2001 From: ratake <32758555+ratake@users.noreply.github.com> Date: Tue, 7 Nov 2017 20:44:13 -0800 Subject: [PATCH] Implement Clone for all types Not just CFString --- core-foundation/src/lib.rs | 9 +++++++++ core-foundation/src/string.rs | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) 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 {