pub struct CallbackExecutor { /* private fields */ }Expand description
A simple executor that queues callbacks for later processing
The executor provides a thread-safe way to enqueue callbacks from subscriber threads and process them in the node’s spin loop.
Implementations§
Source§impl CallbackExecutor
impl CallbackExecutor
Sourcepub fn enqueue(&self, callback: Callback)
pub fn enqueue(&self, callback: Callback)
Enqueues a callback for later processing
This method is thread-safe and can be called from subscriber callbacks.
Sourcepub fn process_pending(&self) -> usize
pub fn process_pending(&self) -> usize
Processes all pending callbacks
Returns the number of callbacks that were processed.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Returns the number of pending callbacks
Sourcepub fn notified(&self) -> Notified<'_>
pub fn notified(&self) -> Notified<'_>
Returns a future that resolves when a callback is enqueued or shutdown is signaled. Must be called (to register interest) before draining the queue.
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Signals the executor to shutdown
After shutdown, no new callbacks will be accepted.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Returns true if the executor has been shutdown
Trait Implementations§
Source§impl Clone for CallbackExecutor
impl Clone for CallbackExecutor
Source§fn clone(&self) -> CallbackExecutor
fn clone(&self) -> CallbackExecutor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CallbackExecutor
impl RefUnwindSafe for CallbackExecutor
impl Send for CallbackExecutor
impl Sync for CallbackExecutor
impl Unpin for CallbackExecutor
impl UnsafeUnpin for CallbackExecutor
impl UnwindSafe for CallbackExecutor
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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