pub struct StreamWriter { /* private fields */ }Expand description
The sending side of a stream (§9.4).
Owns the (session, segment, seq) bookkeeping so a node cannot forget to
advance the sequence or to end a segment.
Implementations§
Source§impl StreamWriter
impl StreamWriter
Sourcepub fn with_session(session: impl Into<String>) -> Self
pub fn with_session(session: impl Into<String>) -> Self
A writer over an existing session id.
Sourcepub const fn finished_segments(&self) -> u64
pub const fn finished_segments(&self) -> u64
How many segments this writer has finished.
Sourcepub fn next_metadata(
&mut self,
base: Metadata,
fin: bool,
flush: bool,
) -> Metadata
pub fn next_metadata( &mut self, base: Metadata, fin: bool, flush: bool, ) -> Metadata
The metadata for the next chunk, advancing the sequence.
fin ends the segment: the next chunk starts segment n + 1 at
sequence zero.
Sourcepub fn abandon_segment(&mut self)
pub fn abandon_segment(&mut self)
Starts a new segment without finishing the current one.
For a sender that gave up on a partially sent message; the receiver
sees the abandoned segment in
StreamAssembler::open_segments.
Trait Implementations§
Source§impl Clone for StreamWriter
impl Clone for StreamWriter
Source§impl Debug for StreamWriter
impl Debug for StreamWriter
Auto Trait Implementations§
impl Freeze for StreamWriter
impl RefUnwindSafe for StreamWriter
impl Send for StreamWriter
impl Sync for StreamWriter
impl Unpin for StreamWriter
impl UnsafeUnpin for StreamWriter
impl UnwindSafe for StreamWriter
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