pub struct RuntimeEventBatch<'a> { /* private fields */ }Expand description
Batch of runtime events borrowed from runtime-owned storage.
A batch borrows the RuntimeHandle it came from, so
the next drain is a compile error while the batch lives, and an event read
out of a batch borrows the batch. Take RuntimeEventRef::to_owned for a
value that outlives either.
Implementations§
Source§impl<'a> RuntimeEventBatch<'a>
impl<'a> RuntimeEventBatch<'a>
Sourcepub fn remaining(&self) -> usize
pub fn remaining(&self) -> usize
Returns how many events stayed queued after this batch. A nonzero count means another drain reports more events.
Sourcepub fn iter(&self) -> impl Iterator<Item = RuntimeEventRef<'_>>
pub fn iter(&self) -> impl Iterator<Item = RuntimeEventRef<'_>>
Walks this batch’s events in queue order.
Each event borrows this batch, so safe code cannot read one after the batch is gone:
ⓘ
let mut runtime = RuntimeHandle::with_options(&RuntimeOptions::default()).unwrap();
let batch = runtime.drain_events(0).unwrap();
let events = batch.iter().collect::<Vec<_>>();
drop(batch);
let _ = events.first().map(|event| event.message_bytes());Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for RuntimeEventBatch<'a>
impl<'a> RefUnwindSafe for RuntimeEventBatch<'a>
impl<'a> !Send for RuntimeEventBatch<'a>
impl<'a> !Sync for RuntimeEventBatch<'a>
impl<'a> Unpin for RuntimeEventBatch<'a>
impl<'a> UnsafeUnpin for RuntimeEventBatch<'a>
impl<'a> UnwindSafe for RuntimeEventBatch<'a>
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