Struct shadow_rs::utility::callback_queue::CallbackQueue
source · pub struct CallbackQueue(/* private fields */);
Expand description
A queue of events (functions/closures) which when run can add their own events to the queue. This allows events to be deferred and run later.
Implementations§
source§impl CallbackQueue
impl CallbackQueue
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
sourcepub fn run(&mut self)
pub fn run(&mut self)
Process all of the events in the queue (and any new events that are generated).
sourcepub fn queue_and_run_with_legacy<F, U>(f: F) -> Uwhere
F: FnOnce(&mut Self) -> U,
pub fn queue_and_run_with_legacy<F, U>(f: F) -> Uwhere
F: FnOnce(&mut Self) -> U,
A convenience function to create a CallbackQueue, allow the caller to add events, and process them all before returning.
This also has the side-effect of ensuring that a global thread-local queue is configured for
C code using
with_global_cb_queue
. We do
this for convenience and to help prevent bugs where we forget to call
with_global_cb_queue
. Ideally we’d like to remove this side-effect as we remove more C
code from Shadow.
TODO: Once we have removed C file objects, remove this function and make
Self::queue_and_run
public.
Trait Implementations§
source§impl Default for CallbackQueue
impl Default for CallbackQueue
Auto Trait Implementations§
impl Freeze for CallbackQueue
impl !RefUnwindSafe for CallbackQueue
impl !Send for CallbackQueue
impl !Sync for CallbackQueue
impl Unpin for CallbackQueue
impl !UnwindSafe for CallbackQueue
Blanket Implementations§
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> 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