1#![doc = include_str!("../examples/boxed.rs")]
12#![doc = include_str!("../examples/ref_once.rs")]
18#![warn(
20 unsafe_op_in_unsafe_fn,
21 clippy::std_instead_of_core,
22 clippy::alloc_instead_of_core
23)]
24
25extern crate alloc;
32
33mod extended;
34pub mod pointer_like;
35mod ref_once;
36
37pub use extended::Extender;
38pub use extended::func::{extend_fn_mut_unchecked, extend_fn_once_unchecked, extend_fn_unchecked};
39pub use extended::future::extend_future_unchecked;
40pub use extended::future::legacy::ExtendedFuture;
41pub use ref_once::RefOnce;
42
43pub fn lock_scope<'env, F, T>(scope: F) -> T
44where
45 F: for<'scope> FnOnce(&'scope Extender<'scope, 'env>) -> T,
46{
47 let rw_lock = extended::sync::ReferenceCounter::new();
48 let extender = Extender::new(&rw_lock);
49 let _guard = extender.guard();
50 scope(&extender)
51}
52
53