pub struct BatchEncoder { /* private fields */ }Expand description
Reusable encoder. Once capacities are warmed, clear and finish allocate no memory.
Implementations§
Source§impl BatchEncoder
impl BatchEncoder
pub fn with_capacity( record_bytes: usize, string_bytes: usize, string_count: usize, ) -> Self
pub fn clear(&mut self)
pub fn encode(&mut self, mutation: &Mutation<'_>) -> Result<(), ProtocolError>
pub fn finish(&mut self) -> Result<&[u8], ProtocolError>
Sourcepub fn arena(&self) -> (*const u8, usize)
pub fn arena(&self) -> (*const u8, usize)
Where the arena a finished batch lives in starts, and how much of it is mapped.
A runtime that cannot read the Host’s memory directly wraps this range once and keeps the view: every batch is a prefix of the arena, so it is read where it lies and no byte is copied out. Growing the arena moves it, which is why the address is reported again on every call rather than once at startup.
pub fn capacity(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BatchEncoder
impl RefUnwindSafe for BatchEncoder
impl Send for BatchEncoder
impl Sync for BatchEncoder
impl Unpin for BatchEncoder
impl UnsafeUnpin for BatchEncoder
impl UnwindSafe for BatchEncoder
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