pub struct Streams {
pub send_max_data: u64,
pub control: VecDeque<Control>,
pub events: VecDeque<StreamEvent>,
/* private fields */
}Fields§
§send_max_data: u64§control: VecDeque<Control>§events: VecDeque<StreamEvent>Implementations§
Source§impl Streams
impl Streams
pub fn new(is_server: bool, cfg: StreamConfig) -> Self
Sourcepub fn set_peer_params(&mut self, p: &TransportParams)
pub fn set_peer_params(&mut self, p: &TransportParams)
Applies the peer’s transport parameters.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn open(&mut self, bidi: bool) -> Result<u64, StreamError>
pub fn open(&mut self, bidi: bool) -> Result<u64, StreamError>
Opens a locally initiated stream.
pub fn on_stream( &mut self, id: u64, off: u64, data: &[u8], fin: bool, ) -> Result<(), TransportError>
pub fn on_reset( &mut self, id: u64, code: u64, final_size: u64, ) -> Result<(), TransportError>
pub fn on_stop_sending( &mut self, id: u64, code: u64, ) -> Result<(), TransportError>
pub fn on_max_stream_data( &mut self, id: u64, max: u64, ) -> Result<(), TransportError>
pub fn on_stream_data_blocked(&mut self, id: u64) -> Result<(), TransportError>
pub fn on_max_data(&mut self, max: u64)
pub fn on_max_streams(&mut self, bidi: bool, max: u64)
pub fn on_streams_blocked(&mut self, bidi: bool, limit: u64)
Sourcepub fn write(
&mut self,
id: u64,
data: &[u8],
fin: bool,
) -> Result<usize, StreamError>
pub fn write( &mut self, id: u64, data: &[u8], fin: bool, ) -> Result<usize, StreamError>
Buffers data for sending; returns how many bytes were accepted.
Sourcepub fn read(
&mut self,
id: u64,
out: &mut [u8],
) -> Result<(usize, bool), StreamError>
pub fn read( &mut self, id: u64, out: &mut [u8], ) -> Result<(usize, bool), StreamError>
Reads in-order data; returns (bytes, fin reached).
Sourcepub fn reset(&mut self, id: u64, code: u64) -> Result<(), StreamError>
pub fn reset(&mut self, id: u64, code: u64) -> Result<(), StreamError>
Abandons sending with RESET_STREAM.
Sourcepub fn stop(&mut self, id: u64, code: u64) -> Result<(), StreamError>
pub fn stop(&mut self, id: u64, code: u64) -> Result<(), StreamError>
Asks the peer to stop sending with STOP_SENDING; buffered data is discarded.
pub fn has_pending_data(&self) -> bool
Sourcepub fn write_frames(
&mut self,
out: &mut Vec<u8>,
limit: usize,
sent: &mut Vec<SentFrame>,
)
pub fn write_frames( &mut self, out: &mut Vec<u8>, limit: usize, sent: &mut Vec<SentFrame>, )
Writes STREAM frames into out while at least min_room bytes are left before
limit; records (id, off, len, fin) in sent.
Sourcepub fn write_control(
&mut self,
c: Control,
out: &mut Vec<u8>,
limit: usize,
) -> Option<bool>
pub fn write_control( &mut self, c: Control, out: &mut Vec<u8>, limit: usize, ) -> Option<bool>
Writes one control frame if it fits; returns false when it does not.
pub fn on_stream_acked(&mut self, id: u64, off: u64, len: u64, fin: bool)
pub fn on_stream_lost(&mut self, id: u64, off: u64, len: u64, fin: bool)
pub fn on_reset_acked(&mut self, id: u64)
Auto Trait Implementations§
impl Forget for Streams
impl Freeze for Streams
impl Move for Streams
impl RefUnwindSafe for Streams
impl Send for Streams
impl Sync for Streams
impl Unpin for Streams
impl UnsafeUnpin for Streams
impl UnwindSafe for Streams
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