Enum Connection

Source
pub enum Connection<S1, S2> {
    Streaming(StreamingConnection<S1>),
    Websocket(WebsocketConnection<S2>),
}

Variants§

§

Streaming(StreamingConnection<S1>)

§

Websocket(WebsocketConnection<S2>)

Implementations§

Source§

impl<S1, S2> Connection<S1, S2>

Source

pub fn poll_read_next( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<ServerOp, ConnectionReadError>>

Source

pub async fn read_next(&mut self) -> Result<ServerOp, ConnectionReadError>

Read the next incoming server operation.

§Errors

Returns an error if reading or decoding the message fails.

Source

pub fn flushes_automatically_when_full(&self) -> bool

Source

pub fn should_flush(&self) -> bool

Source

pub fn may_enqueue_more_ops(&mut self) -> bool

Source

pub fn enqueue_write_op(&mut self, item: &ClientOp)

Source

pub async fn write_and_flush(&mut self) -> Result<()>

Convenience function for writing enqueued messages and flushing.

§Errors

Returns an error if writing or flushing fails.

Source

pub fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>

Source

pub async fn flush(&mut self) -> Result<()>

Flush any buffered writes to the connection

§Errors

Returns an error if flushing fails

Source

pub async fn shutdown(&mut self) -> Result<()>

Shutdown the connection

§Errors

Returns an error if shutting down the connection fails. Implementations usually ignore this error.

Trait Implementations§

Source§

impl<S1: Debug, S2: Debug> Debug for Connection<S1, S2>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S1, S2> !Freeze for Connection<S1, S2>

§

impl<S1, S2> RefUnwindSafe for Connection<S1, S2>

§

impl<S1, S2> Send for Connection<S1, S2>
where S1: Send, S2: Send,

§

impl<S1, S2> Sync for Connection<S1, S2>
where S1: Sync, S2: Sync,

§

impl<S1, S2> Unpin for Connection<S1, S2>
where S1: Unpin, S2: Unpin,

§

impl<S1, S2> UnwindSafe for Connection<S1, S2>
where S1: UnwindSafe, S2: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T