diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index 4f310ba8f..bc90f0cf9 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -413,7 +413,7 @@ pub mod os; mod painter; mod pass_state; pub(crate) mod placer; -mod plugin; +pub mod plugin; pub mod response; mod sense; pub mod style; diff --git a/crates/egui/src/plugin.rs b/crates/egui/src/plugin.rs index 3967e737d..d480cc770 100644 --- a/crates/egui/src/plugin.rs +++ b/crates/egui/src/plugin.rs @@ -55,6 +55,9 @@ pub(crate) struct PluginHandle { plugin: Box, } +/// A typed handle to a registered [`Plugin`]. +/// +/// Use [`Self::lock`] to access the plugin. pub struct TypedPluginHandle { handle: Arc>, _type: std::marker::PhantomData

, @@ -68,6 +71,9 @@ impl TypedPluginHandle

{ } } + /// Lock the plugin for access. + /// + /// Returns a guard that dereferences to the plugin. pub fn lock(&self) -> TypedPluginGuard<'_, P> { TypedPluginGuard { guard: self.handle.lock(), @@ -76,6 +82,7 @@ impl TypedPluginHandle

{ } } +/// A guard that provides access to a [`Plugin`]. pub struct TypedPluginGuard<'a, P: Plugin> { guard: MutexGuard<'a, PluginHandle>, _type: std::marker::PhantomData

,