Skip to main content

FrameReaderBuilder

Struct FrameReaderBuilder 

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

Builder for FrameReader.

Implementations§

Source§

impl FrameReaderBuilder

Source

pub fn buffer_capacity(self, n: usize) -> FrameReaderBuilder

ReadBuf capacity. Default: 1MB.

Source

pub fn pre_padding(self, n: usize) -> FrameReaderBuilder

ReadBuf pre-padding. Default: 16.

Source

pub fn post_padding(self, n: usize) -> FrameReaderBuilder

ReadBuf post-padding. Default: 4.

Source

pub fn message_capacity(self, n: usize) -> FrameReaderBuilder

Pre-allocate message assembly buffer. Default: 4KB.

Source

pub fn compact_at(self, fraction: f64) -> FrameReaderBuilder

Fraction of buffer capacity consumed before proactive compaction.

When the read head has advanced past this fraction of the buffer, should_compact() returns true. This spreads compaction cost across messages instead of concentrating it in a single stall when the buffer runs out of spare room.

  • 1.0: never proactively compact — only when spare is empty.
  • 0.5 (default): compact when half the buffer has been consumed.
  • 0.0: compact on every recv after the first byte is consumed (degenerate — not useful in practice).

Lower values reduce tail latency at the cost of more frequent (but smaller) memmoves.

Source

pub fn max_frame_size(self, n: u64) -> FrameReaderBuilder

Maximum single frame payload. Default: 16MB.

Source

pub fn max_message_size(self, n: usize) -> FrameReaderBuilder

Maximum assembled message size. Default: 16MB.

Source

pub fn role(self, r: Role) -> FrameReaderBuilder

Connection role. Default: Server.

Source

pub fn build(self) -> FrameReader

Build the reader.

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V