pub struct StreamInboundState {
pub buffer: RingBuf<u8>,
pub buffer_offset: u64,
pub received: RangeSet,
pub message_offsets: BTreeMap<u64, Option<u32>>,
pub is_reliable: bool,
pub window_limit: u64,
pub final_offset: Option<u64>,
}
Expand description
stream inbound buffer
Fields§
§buffer: RingBuf<u8>
buffer for received data
buffer_offset: u64
stream offset at which buffer starts
received: RangeSet
received segments
message_offsets: BTreeMap<u64, Option<u32>>
offsets into the stream where messages begin, if applicable
is_reliable: bool
whether stream is operating in reliable mode
window_limit: u64
flow control limit
final_offset: Option<u64>
final length of stream (offset of final byte + 1)
Implementations§
Source§impl StreamInboundState
impl StreamInboundState
Sourcepub fn new(initial_window_limit: u64, is_reliable: bool) -> StreamInboundState
pub fn new(initial_window_limit: u64, is_reliable: bool) -> StreamInboundState
create new instance
Sourcepub fn receive_segment(
&mut self,
offset: u64,
data: &[u8],
) -> ReceiveSegmentResult
pub fn receive_segment( &mut self, offset: u64, data: &[u8], ) -> ReceiveSegmentResult
process incoming segment
Sourcepub fn set_message_marker(&mut self, offset: u64)
pub fn set_message_marker(&mut self, offset: u64)
set message marker at offset
Sourcepub fn set_final_offset(&mut self, offset: u64) -> bool
pub fn set_final_offset(&mut self, offset: u64) -> bool
set final offset from sender
Sourcepub fn advance_buffer(&mut self, new_base: u64)
pub fn advance_buffer(&mut self, new_base: u64)
advance buffer, discarding data lower than the new base offset
Sourcepub fn read_segment(&self, segment: Range<u64>) -> Option<RingBufSlice<'_, u8>>
pub fn read_segment(&self, segment: Range<u64>) -> Option<RingBufSlice<'_, u8>>
read segment from buffer, if available
Sourcepub fn max_contiguous_offset(&self) -> Option<u64>
pub fn max_contiguous_offset(&self) -> Option<u64>
return the highest offset into the stream for which no gaps exist
between it and buffer_offset
Auto Trait Implementations§
impl Freeze for StreamInboundState
impl RefUnwindSafe for StreamInboundState
impl Send for StreamInboundState
impl Sync for StreamInboundState
impl Unpin for StreamInboundState
impl UnwindSafe for StreamInboundState
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