Skip to main content

WriteEncoder

Struct WriteEncoder 

Source
pub struct WriteEncoder<'a> { /* private fields */ }
Expand description

A borrowed write producer. Before emitting, it encodes one record at a time to measure each part’s byte length and construct the header; emitting a part retains at most one record frame and one 64-KiB chunk.

Implementations§

Source§

impl<'a> WriteEncoder<'a>

Source

pub fn new(record: &'a WriteRecord) -> Result<Self, Error>

Validate the complete in-memory write and measure each part’s stream.

Source

pub fn with_records( record: &'a WriteRecord, encoded: &'a [Vec<Vec<u8>>], ) -> Result<Self, Error>

new for a write whose records the caller encoded already, a part’s WritePart::encode_records each, in the parts’ order: they are emitted as given, validated and encoded once, and the bytes are those new produces.

Source

pub fn header(&self) -> &WriteHeaderFrame

Metadata that lets a receiver delimit each part without opening it.

Source

pub fn header_frame(&self) -> &[u8] ⓘ

The header’s complete kind-1 plaintext frame.

Source

pub fn plaintext_length(&self) -> u64

The queued plaintext length, for the database’s SQLite value limit.

Source

pub fn encode_plaintext(&self, output: &mut [u8]) -> Result<(), Error>

Encode the upload-queue value into an exactly sized buffer. The database checks Self::plaintext_length against SQLite’s limit before allocating this buffer. A different buffer length is refused before writing bytes.

Source

pub fn part_chunks( &self, index: usize, ) -> Result<PlaintextChunks<impl Iterator<Item = Result<Vec<u8>, Error>> + '_>, Error>

Cut the selected audience’s change and dismissal frames into canonical plaintext chunks.

Auto Trait Implementations§

§

impl<'a> Freeze for WriteEncoder<'a>

§

impl<'a> RefUnwindSafe for WriteEncoder<'a>

§

impl<'a> Send for WriteEncoder<'a>

§

impl<'a> Sync for WriteEncoder<'a>

§

impl<'a> Unpin for WriteEncoder<'a>

§

impl<'a> UnsafeUnpin for WriteEncoder<'a>

§

impl<'a> UnwindSafe for WriteEncoder<'a>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,