[][src]Struct async_protocol::AsyncConnection

pub struct AsyncConnection<P: Parcel, S: AsyncRead + AsyncWrite + Send + Unpin> {
    pub stream: S,
    pub transport: Simple,
    pub middleware: Default,
    pub settings: Settings,
    pub _parcel: PhantomData<P>,
}

A stream-based connection.

Fields

stream: Stransport: Simplemiddleware: Defaultsettings: Settings_parcel: PhantomData<P>

Implementations

impl<P, S> Connection<P, S> where
    P: Parcel,
    S: AsyncRead + AsyncWrite + Send + Unpin
[src]

pub fn new(stream: S, settings: Settings) -> Self[src]

Creates a new connection.

pub async fn receive_packet(&mut self) -> Result<Option<P>, Error>[src]

Attempts to receive a packet.

pub async fn send_packet(&mut self, packet: &P) -> Result<(), Error>[src]

Sends a packet.

pub fn into_inner(self) -> S[src]

pub fn split(self) -> (ReceiveConnection<P, S>, SendConnection<P, S>)[src]

Split Connection into ReceiverConnection and SendConnection

Trait Implementations

impl<P: Debug + Parcel, S: Debug + AsyncRead + AsyncWrite + Send + Unpin> Debug for Connection<P, S>[src]

Auto Trait Implementations

impl<P, S> RefUnwindSafe for Connection<P, S> where
    P: RefUnwindSafe,
    S: RefUnwindSafe
[src]

impl<P, S> Send for Connection<P, S> where
    P: Send
[src]

impl<P, S> Sync for Connection<P, S> where
    P: Sync,
    S: Sync
[src]

impl<P, S> Unpin for Connection<P, S> where
    P: Unpin
[src]

impl<P, S> UnwindSafe for Connection<P, S> where
    P: UnwindSafe,
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.