pub struct Incoming<T>where
T: DeserializeOwned,{ /* private fields */ }
Expand description
An intermediate state to define which type to accept in this stream. See
accept_stream
.
Implementations§
§impl<T> Incoming<T>where
T: DeserializeOwned,
impl<T> Incoming<T>where T: DeserializeOwned,
pub async fn type(&mut self) -> impl Future<Output = Result<&T, &Incoming>>
pub async fn type(&mut self) -> impl Future<Output = Result<&T, &Incoming>>
Returns the type information for that stream.
Errors
error::Incoming::Receiver
if receiving the type information to the peer failed, seeerror::Receiver
for more detailserror::Incoming::Closed
if the stream was closed
pub async fn accept<S, R>(
self
) -> impl Future<Output = Result<(Sender<S>, Receiver<R>), Incoming>>where
S: DeserializeOwned + Serialize + Send + 'static,
R: DeserializeOwned + Serialize + Send + 'static,
pub async fn accept<S, R>( self ) -> impl Future<Output = Result<(Sender<S>, Receiver<R>), Incoming>>where S: DeserializeOwned + Serialize + Send + 'static, R: DeserializeOwned + Serialize + Send + 'static,
Accept the incoming stream with the given types.
Use S
and R
to define which type this stream is sending and
receiving.
Errors
error::Incoming::Receiver
if receiving the type information to the peer failed, seeerror::Receiver
for more detailserror::Incoming::Closed
if the stream was closed
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Incoming<T>
impl<T> Send for Incoming<T>where T: Send,
impl<T> Sync for Incoming<T>where T: Sync,
impl<T> Unpin for Incoming<T>where T: Unpin,
impl<T> !UnwindSafe for Incoming<T>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
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