diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2022-04-26 09:14:09 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2022-04-26 09:14:09 -0300 |
commit | 25d5d6f4e9ed901d284633691941c52c8556d17c (patch) | |
tree | c353158113eba06e67e37a77caf337a8bf1c270e /src/extra_tests.rs | |
parent | 83db3d819b7402b4f3c6ca023ddfea6204fae4b4 (diff) |
Project ValidContext to Fields<'_, '_, Contexts>
Diffstat (limited to 'src/extra_tests.rs')
-rw-r--r-- | src/extra_tests.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/extra_tests.rs b/src/extra_tests.rs index 8aed5a9..b64cc22 100644 --- a/src/extra_tests.rs +++ b/src/extra_tests.rs @@ -4,7 +4,7 @@ //! use std::mem; //! use hexchat_unsafe_plugin::PluginHandle; //! -//! fn prepoop_your_pants_pluginhandle<'ph>(ph: &mut PluginHandle<'ph>) { +//! fn prepoop_your_pants_pluginhandle(ph: &mut PluginHandle<'_>) { //! let temporary: String = "Hello, world!".to_string(); //! let hook = ph.hook_timer(0, |_| { //! println!("{}", temporary); @@ -12,3 +12,21 @@ //! }); //! } //! ``` +//! +//! ```compile_fail +//! use hexchat_unsafe_plugin::list::Contexts; +//! use hexchat_unsafe_plugin::PluginHandle; +//! +//! fn unsound(ph: &mut PluginHandle<'_>) { +//! ph.ensure_valid_context(|mut ph| { +//! let mut list = ph.list(&Contexts); +//! let context = list.next().unwrap(); +//! write!(ph, "{}", context.name().unwrap()); +//! std::mem::forget(list); +//! write!(ph, "{}", context.name().unwrap()); +//! let ctx = context.context(); +//! ph.set_context(&ctx); +//! write!(ph, "{}", context.name().unwrap()); +//! }) +//! } +//! ``` |