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 Self
pub fn send(&mut self, chunks: &'a mut [Bytes]) -> &mut Self
Requests a slice of chunks to be sent on the tx stream
Sourcepub fn finish(&mut self) -> &mut Self
pub fn finish(&mut self) -> &mut Self
Marks the tx stream as finished (e.g. no more data will be sent)
Sourcepub fn receive(&mut self, chunks: &'a mut [Bytes]) -> &mut Self
pub fn receive(&mut self, chunks: &'a mut [Bytes]) -> &mut Self
Requests data on the rx stream to be received into the provided slice of chunks
Sourcepub fn stop_sending(&mut self, error: Error) -> &mut Self
pub fn stop_sending(&mut self, error: Error) -> &mut Self
Requests the peer to stop sending data on the rx stream
Sourcepub fn with_watermark(&mut self, low: usize, high: usize) -> &mut Self
pub fn with_watermark(&mut self, low: usize, high: usize) -> &mut Self
Sets the watermarks for the rx stream
Sourcepub fn with_low_watermark(&mut self, low: usize) -> &mut Self
pub fn with_low_watermark(&mut self, low: usize) -> &mut Self
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 Self
pub fn with_high_watermark(&mut self, high: usize) -> &mut Self
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.