From ed0f004fd468bb73fd0b7c3313bb31737a7b4711 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 4 Sep 2024 12:42:49 +0200 Subject: [PATCH] Better document pre_existing --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 0150a77..10bc56c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -81,7 +81,14 @@ impl Layer { ptr as *mut _ } - /// Whether `raw-window-metal` created a new [`CAMetalLayer`] for you. + /// If `raw-window-metal` created a new [`CAMetalLayer`] for you, this returns `false`. + /// + /// This may be useful if you want to override some part of `raw-window-metal`'s behaviour, and + /// need to do so based on whether it ended up creating a layer or not. + /// + /// You should try to avoid this, and instead: + /// - Modify `CALayer` properties on the layer that you created this from. + /// - Modify `CAMetalLayer` properties on the layer returned from `as_ptr`. #[inline] pub fn pre_existing(&self) -> bool { self.pre_existing