pub struct FrameReaderBuilder { /* private fields */ }Expand description
Builder for FrameReader.
Implementations§
Source§impl FrameReaderBuilder
impl FrameReaderBuilder
Sourcepub fn buffer_capacity(self, n: usize) -> Self
pub fn buffer_capacity(self, n: usize) -> Self
ReadBuf capacity. Default: 1MB.
Sourcepub fn pre_padding(self, n: usize) -> Self
pub fn pre_padding(self, n: usize) -> Self
ReadBuf pre-padding. Default: 16.
Sourcepub fn post_padding(self, n: usize) -> Self
pub fn post_padding(self, n: usize) -> Self
ReadBuf post-padding. Default: 4.
Sourcepub fn message_capacity(self, n: usize) -> Self
pub fn message_capacity(self, n: usize) -> Self
Pre-allocate message assembly buffer. Default: 4KB.
Sourcepub fn compact_at(self, fraction: f64) -> Self
pub fn compact_at(self, fraction: f64) -> Self
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.
Sourcepub fn max_frame_size(self, n: u64) -> Self
pub fn max_frame_size(self, n: u64) -> Self
Maximum single frame payload. Default: 16MB.
Sourcepub fn max_message_size(self, n: usize) -> Self
pub fn max_message_size(self, n: usize) -> Self
Maximum assembled message size. Default: 16MB.
Sourcepub fn build(self) -> FrameReader
pub fn build(self) -> FrameReader
Build the reader.
Auto Trait Implementations§
impl Freeze for FrameReaderBuilder
impl RefUnwindSafe for FrameReaderBuilder
impl Send for FrameReaderBuilder
impl Sync for FrameReaderBuilder
impl Unpin for FrameReaderBuilder
impl UnsafeUnpin for FrameReaderBuilder
impl UnwindSafe for FrameReaderBuilder
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