diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 9a931c11..9c65ef88 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -92,12 +92,7 @@ impl CGSize { } unsafe impl Encode for CGSize { - /// Adds support for CGSize Objective-C encoding. - fn encode() -> Encoding { - let encoding = format!("{{CGSize={}{}}}", CGFloat::encode().as_str(), CGFloat::encode().as_str()); - - unsafe { Encoding::from_str(&encoding) } - } + const ENCODING: Encoding<'static> = Encoding::Struct("CGSize", &[CGFloat::ENCODING, CGFloat::ENCODING]); } /// A helper method for ensuring that Cocoa is running in multi-threaded mode.