pub struct Stream { /* private fields */ }Expand description
One streaming session, on either side. Cloning it shares the session.
Implementations§
Source§impl Stream
impl Stream
Sourcepub fn report(&self) -> Result<Report, ReportError>
pub fn report(&self) -> Result<Report, ReportError>
This caller stream’s seal report. It settles on the provider’s first
STREAM_DATA or STREAM_REPLY opened under the stream’s key; on a clear
stream, on its first STREAM_DATA, STREAM_REPLY or STREAM_END. A sealed
stream’s STREAM_END travels clear and settles nothing, and no error
settles a stream. Before it settles, and on a stream that ended
first, it is ReportError::NotSettled; on a served stream,
ReportError::NotACaller. A stream that settled and then ended, an
error included, keeps its report.
Source§impl Stream
impl Stream
Sourcepub fn request(&self) -> &VerifiedRequest
pub fn request(&self) -> &VerifiedRequest
The stream’s verified STREAM_OPEN: its caller, procedure, mode and payload. On a provider’s side of a sealed stream the payload is the open’s opened plaintext.
Sourcepub fn sealed(&self) -> bool
pub fn sealed(&self) -> bool
Whether the stream is sealed end to end: every chunk, reply and error after the open travels sealed.
Sourcepub async fn close_send(&self) -> Result<(), LinkError>
pub async fn close_send(&self) -> Result<(), LinkError>
Ends this side’s sending; the peer may still send.
Sourcepub async fn reply(&self, payload: Value) -> Result<(), LinkError>
pub async fn reply(&self, payload: Value) -> Result<(), LinkError>
Sends the provider’s terminal value and ends the stream.
Sourcepub async fn abort(&self, code: &str, message: &str) -> Result<(), LinkError>
pub async fn abort(&self, code: &str, message: &str) -> Result<(), LinkError>
Ends the stream with a STREAM_ERROR of code and message.
Sourcepub async fn recv(&self) -> Result<StreamEvent, LinkError>
pub async fn recv(&self) -> Result<StreamEvent, LinkError>
The next frame the peer sent. After the stream ends, once every event
before it is read, it returns LinkError::EndOfStream for a normal
end and the error that ended it otherwise.