[−][src]Struct scoped_callback::Scope
A Scope
is used to register callbacks.
See Scope::register.
Methods
impl<'env> Scope<'env>
[src]
pub fn register<'scope, A: 'static, R: 'static, H: 'static>(
&'scope self,
c: impl FnMut(A) -> R + 'env,
register: impl FnOnce(Box<dyn FnMut(A) -> R>) -> H + 'env,
deregister: impl FnOnce(H) + 'env
) -> Registered<'env, 'scope>
[src]
&'scope self,
c: impl FnMut(A) -> R + 'env,
register: impl FnOnce(Box<dyn FnMut(A) -> R>) -> H + 'env,
deregister: impl FnOnce(H) + 'env
) -> Registered<'env, 'scope>
Register the function c
with local lifetime 'env
using the register
and deregister
functions that handle only 'static
lifetime functions.
The returned Registered
object will, when dropped, invoke the deregister
function.
If the Registered
object is std::mem::forget
-ed, Scope::drop
will
perform the de-registration.
Note: If the callback passed to the register
function is invoked after deregister
has been invoked, the callback will panic!
.
pub fn future<'scope>(
&'scope self,
future: LocalBoxFuture<'env, ()>
) -> impl Future<Output = ()> + 'static
[src]
&'scope self,
future: LocalBoxFuture<'env, ()>
) -> impl Future<Output = ()> + 'static
Wrap a scoped Future
into one with a 'static
lifetime.
Future::poll
will panic!
if called after the scope has been dropped.
Trait Implementations
Auto Trait Implementations
impl<'env> !RefUnwindSafe for Scope<'env>
impl<'env> !Send for Scope<'env>
impl<'env> !Sync for Scope<'env>
impl<'env> Unpin for Scope<'env>
impl<'env> !UnwindSafe for Scope<'env>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,