pub struct IpcWriteContext {
scratch: Vec<u8>,
reserve_scratch: bool,
fbb: FlatBufferBuilder<'static>,
compressor: Option<Compressor<'static>>,
}Expand description
Additional context that may be needed for compression.
In the case of zstd, this will contain the zstd context, which can be reused between subsequent
compression calls to avoid the performance overhead of initialising a new context for every
compression. Also holds a [FlatBufferBuilder] that is reused across IPC writes.
Fields§
§scratch: Vec<u8>§reserve_scratch: bool§fbb: FlatBufferBuilder<'static>§compressor: Option<Compressor<'static>>Implementations§
Source§impl IpcWriteContext
impl IpcWriteContext
Sourcepub(crate) fn mut_fbb(&mut self) -> &mut FlatBufferBuilder<'static>
pub(crate) fn mut_fbb(&mut self) -> &mut FlatBufferBuilder<'static>
Get a mutable reference to the [FlatBufferBuilder] that is reused across IPC writes.
Sourcepub fn set_reserve_scratch(&mut self, reserve: bool)
pub fn set_reserve_scratch(&mut self, reserve: bool)
Set whether the scratch buffer capacity should be reserved after each encode for reuse
on the next call. Set to false for the final batch in a sequence to avoid a
pointless allocation. by default, this is set to false.
Sourcepub(crate) fn reserve_scratch_with_capacity(&mut self, additional: usize)
pub(crate) fn reserve_scratch_with_capacity(&mut self, additional: usize)
Reserve the scratch buffer capacity for reuse on the next call. This is a no-op if
reserve_scratch is set to false.
pub(crate) fn scratch(&mut self) -> Vec<u8> ⓘ
fn zstd_compressor(&mut self, level: i32) -> &mut Compressor<'static>
Trait Implementations§
Source§impl Debug for IpcWriteContext
impl Debug for IpcWriteContext
Source§impl Default for IpcWriteContext
impl Default for IpcWriteContext
Source§fn default() -> IpcWriteContext
fn default() -> IpcWriteContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IpcWriteContext
impl RefUnwindSafe for IpcWriteContext
impl Send for IpcWriteContext
impl Sync for IpcWriteContext
impl Unpin for IpcWriteContext
impl UnsafeUnpin for IpcWriteContext
impl UnwindSafe for IpcWriteContext
Blanket Implementations§
impl<T> Allocation for T
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