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 request(&self) -> &VerifiedRequest
pub fn request(&self) -> &VerifiedRequest
The stream’s verified STREAM_OPEN: its caller, procedure, mode and payload.
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.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Stream
impl !UnwindSafe for Stream
impl Freeze for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl UnsafeUnpin for Stream
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