summary refs log tree commit diff stats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index bff39e2..4bd5de3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -589,7 +589,21 @@ impl<'ph> PluginHandle<'ph> {
     }
 
     /// Operates on a virtual plugin.
-    pub fn for_entry_mut<F, R>(&mut self, entry: &mut PluginEntryHandle<'ph>, f: F) -> R where F: for<'eh> FnOnce(&mut PluginHandle<'eh>) -> R {
+    ///
+    /// # Examples
+    ///
+    /// ```no_run
+    /// use hexchat_unsafe_plugin::{PluginHandle};
+    ///
+    /// fn contexts_can_be_passed_in(ph: &mut PluginHandle<'_>) {
+    ///     let ctx = ph.get_context();
+    ///     let mut vplug = ph.plugingui_add("foo", "bar", "baz", "qux");
+    ///     ph.for_entry_mut(&mut vplug, |ph| {
+    ///         ph.set_context(&ctx);
+    ///     });
+    /// }
+    /// ```
+    pub fn for_entry_mut<'eh, F, R>(&mut self, entry: &mut PluginEntryHandle<'ph>, f: F) -> R where F: FnOnce(&mut PluginHandle<'eh>) -> R, 'ph: 'eh {
         // we're doing something kinda (very) weird here, but this is the only
         // way to get and set pluginprefs for virtual plugins.
         // this should be sound.