From e8157aa54eda36bba7abe0c773654edc8675361d Mon Sep 17 00:00:00 2001 From: Xiaopeng Li Date: Sun, 29 Jan 2023 18:41:02 +0800 Subject: [PATCH] Add CALayer::from_raw --- cocoa/src/quartzcore.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cocoa/src/quartzcore.rs b/cocoa/src/quartzcore.rs index 5a63f4acd..6a0143c58 100644 --- a/cocoa/src/quartzcore.rs +++ b/cocoa/src/quartzcore.rs @@ -38,6 +38,7 @@ pub fn current_media_time() -> CFTimeInterval { // CALayer.h +#[repr(transparent)] pub struct CALayer(id); unsafe impl Send for CALayer {} @@ -74,6 +75,11 @@ impl CALayer { } } + #[inline] + pub unsafe fn from_raw(raw: id) -> Self { + Self(raw) + } + #[inline] pub fn from_layer(other: &CALayer) -> CALayer { unsafe {