pub struct Event { /* private fields */ }
Implementations§
Source§impl Event
impl Event
Sourcepub fn new<InnerFn>(_description: impl FnOnce() -> InnerFn) -> Self
pub fn new<InnerFn>(_description: impl FnOnce() -> InnerFn) -> Self
See [event_listener::Event::new
]. May attach a description that may optionally be read
later.
This confusingly takes a closure (FnOnce
) that returns a nested closure (Fn
).
When hanging_detection
is disabled, description
is never called.
When hanging_detection
is enabled, the outer closure is called immediately. The outer
closure can have an ephemeral lifetime. The inner closure must be 'static
, but is called
only when the description
is actually read.
The outer closure allows avoiding extra lookups (e.g. task type info) that may be needed to capture information needed for constructing (moving into) the inner closure.
Sourcepub fn listen(&self) -> EventListener ⓘ
pub fn listen(&self) -> EventListener ⓘ
See [event_listener::Event::listen
].
Sourcepub fn listen_with_note<InnerFn>(
&self,
_note: impl FnOnce() -> InnerFn,
) -> EventListener ⓘ
pub fn listen_with_note<InnerFn>( &self, _note: impl FnOnce() -> InnerFn, ) -> EventListener ⓘ
See [event_listener::Event::listen
]. May attach a note that may optionally be read later.
This confusingly takes a closure (FnOnce
) that returns a nested closure (Fn
).
When hanging_detection
is disabled, note
is never called.
When hanging_detection
is enabled, the outer closure is called immediately. The outer
closure can have an ephemeral lifetime. The inner closer must be 'static
, but is called
only when the note
is actually read.
The outer closure allow avoiding extra lookups (e.g. task type info) that may be needed to capture information needed for constructing (moving into) the inner closure.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations§
§impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more