pub struct StreamPair { /* private fields */ }
Expand description
A pair of [SendStream
] and [RecvStream
] with additional context data.
Implementations§
Source§impl StreamPair
impl StreamPair
pub async fn accept( conn: &Connection, events: &EventSender, ) -> Result<Self, ConnectionError>
Sourcepub async fn read_request(&mut self) -> Result<Request>
pub async fn read_request(&mut self) -> Result<Request>
Read the request.
Will fail if there is an error while reading, or if no valid request is sent.
This will read exactly the number of bytes needed for the request, and leave the rest of the stream for the caller to read.
It is up to the caller do decide if there should be more data.
pub async fn get_request( self, f: impl FnOnce() -> GetRequest, ) -> Result<ProgressWriter>
pub async fn get_many_request( self, f: impl FnOnce() -> GetManyRequest, ) -> Result<ProgressWriter>
pub async fn push_request( self, f: impl FnOnce() -> PushRequest, ) -> Result<ProgressReader>
pub async fn observe_request( self, f: impl FnOnce() -> ObserveRequest, ) -> Result<ProgressWriter>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamPair
impl !RefUnwindSafe for StreamPair
impl Send for StreamPair
impl Sync for StreamPair
impl Unpin for StreamPair
impl !UnwindSafe for StreamPair
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