pub struct Request<'a> {
pub tx: Option<Request<'a>>,
pub rx: Option<Request<'a>>,
}
Expand description
A request made on a stream
Fields§
§tx: Option<Request<'a>>
The tx
options of the request
rx: Option<Request<'a>>
The rx
options of the request
Implementations§
source§impl<'a> Request<'a>
impl<'a> Request<'a>
sourcepub fn send(&mut self, chunks: &'a mut [Bytes]) -> &mut Request<'a>
pub fn send(&mut self, chunks: &'a mut [Bytes]) -> &mut Request<'a>
Requests a slice of chunks to be sent on the tx stream
sourcepub fn reset(&mut self, error: Error) -> &mut Request<'a>
pub fn reset(&mut self, error: Error) -> &mut Request<'a>
Resets the tx stream with an error code
sourcepub fn flush(&mut self) -> &mut Request<'a>
pub fn flush(&mut self) -> &mut Request<'a>
Flushes any pending tx data to be ACKed before unblocking
sourcepub fn finish(&mut self) -> &mut Request<'a>
pub fn finish(&mut self) -> &mut Request<'a>
Marks the tx stream as finished (e.g. no more data will be sent)
sourcepub fn receive(&mut self, chunks: &'a mut [Bytes]) -> &mut Request<'a>
pub fn receive(&mut self, chunks: &'a mut [Bytes]) -> &mut Request<'a>
Requests data on the rx stream to be received into the provided slice of chunks
sourcepub fn stop_sending(&mut self, error: Error) -> &mut Request<'a>
pub fn stop_sending(&mut self, error: Error) -> &mut Request<'a>
Requests the peer to stop sending data on the rx stream
sourcepub fn with_watermark(&mut self, low: usize, high: usize) -> &mut Request<'a>
pub fn with_watermark(&mut self, low: usize, high: usize) -> &mut Request<'a>
Sets the watermarks for the rx stream
sourcepub fn with_low_watermark(&mut self, low: usize) -> &mut Request<'a>
pub fn with_low_watermark(&mut self, low: usize) -> &mut Request<'a>
Sets the low watermark for the rx stream
If the watermark is set to 0
, the caller will be notified as soon as there is data
available on the stream.
If the watermark is greater than 0
, the caller will be notified as soon as there is at
least low
bytes available to be read. Note that the stream may be woken earlier.
sourcepub fn with_high_watermark(&mut self, high: usize) -> &mut Request<'a>
pub fn with_high_watermark(&mut self, high: usize) -> &mut Request<'a>
Sets the high watermark for the rx stream
The stream ensures that all the received data will not exceed the watermark amount. This
can be useful for receiving at most n
bytes.