Skip to main content

BatchEncoder

Struct BatchEncoder 

Source
pub struct BatchEncoder { /* private fields */ }
Expand description

Reusable encoder. Once capacities are warmed, clear and finish allocate no memory.

Implementations§

Source§

impl BatchEncoder

Source

pub fn with_capacity( record_bytes: usize, string_bytes: usize, string_count: usize, ) -> Self

Source

pub fn clear(&mut self)

Source

pub fn encode(&mut self, mutation: &Mutation<'_>) -> Result<(), ProtocolError>

Source

pub fn finish(&mut self) -> Result<&[u8], ProtocolError>

Source

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.

Source

pub fn capacity(&self) -> usize

Trait Implementations§

Source§

impl Default for BatchEncoder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.