pub struct EventBuffer<'a> { /* private fields */ }Expand description
Caller-owned, pre-allocated event sink for one or more commands.
The buffer borrows a Vec<ExecutionEvent> the caller has already
reserved capacity on. The engine checks the remaining capacity in
preflight against the command’s worst-case event count and returns
crate::BookError::EventBufferFull before mutating anything when
it does not fit, so a push inside the engine can never grow the
vector. Events written by one command are the tail slice reported by
EventBuffer::written.
Implementations§
Source§impl<'a> EventBuffer<'a>
impl<'a> EventBuffer<'a>
Sourcepub const fn new(out: &'a mut Vec<ExecutionEvent>) -> Self
pub const fn new(out: &'a mut Vec<ExecutionEvent>) -> Self
Wrap a caller vector. Events already in the vector are left alone; capacity beyond its current length is the space commands may use.
Sourcepub const fn remaining(&self) -> usize
pub const fn remaining(&self) -> usize
Free event slots: reserved capacity minus current length.
Sourcepub fn written(&self) -> &[ExecutionEvent]
pub fn written(&self) -> &[ExecutionEvent]
Events written since this buffer was created.
Auto Trait Implementations§
impl<'a> !UnwindSafe for EventBuffer<'a>
impl<'a> Forget for EventBuffer<'a>
impl<'a> Freeze for EventBuffer<'a>
impl<'a> Move for EventBuffer<'a>
impl<'a> RefUnwindSafe for EventBuffer<'a>
impl<'a> Send for EventBuffer<'a>
impl<'a> Sync for EventBuffer<'a>
impl<'a> Unpin for EventBuffer<'a>
impl<'a> UnsafeUnpin for EventBuffer<'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