From e5a97d14ad2e38fbeaf44970a4d82d5e9add2a10 Mon Sep 17 00:00:00 2001 From: Konkitoman Date: Fri, 25 Aug 2023 12:20:55 +0300 Subject: [PATCH] Add some documentation --- crates/egui/src/containers/window.rs | 2 ++ crates/egui/src/context.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/crates/egui/src/containers/window.rs b/crates/egui/src/containers/window.rs index c5ff16d86..995b87685 100644 --- a/crates/egui/src/containers/window.rs +++ b/crates/egui/src/containers/window.rs @@ -301,6 +301,7 @@ impl<'open> Window<'open> { } impl<'open> Window<'open> { + /// You can only use this on the main thread, or use ```Window::show_async``` /// Returns `None` if the window is not open (if [`Window::open`] was called with `&mut false`). /// Returns `Some(InnerResponse { inner: None })` if the window is collapsed. #[inline] @@ -312,6 +313,7 @@ impl<'open> Window<'open> { self.show_dyn(ctx, Box::new(add_contents)) } + /// You will probably need to put your state in a ```Arc>``` #[inline] pub fn show_async(self, ctx: &Context, add_contents: impl Fn(&mut Ui) + Send + Sync + 'static) { self.show_dyn_async(ctx, Box::new(add_contents)); diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index 9f2e8eaa8..75c8e7d6a 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -2307,6 +2307,7 @@ impl Context { } } + /// This can only be called in the main thread, you can use ```Context::create_viewport_async``` /// When this is called the current viewport will be paused /// This will render in a native window if he can! /// When this finishes then the last viewport will continue drawing