Struct StreamingConnection

Source
pub struct StreamingConnection<S> { /* private fields */ }

Implementations§

Source§

impl<S> StreamingConnection<S>
where S: AsyncRead + AsyncWrite + Unpin,

Source

pub fn new(socket: S) -> Self

Source

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

Source

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

Reads the next ServerOp.

§Errors

It returns an error if the content cannot be decoded or if an I/O error occurs.

Source

pub fn may_write(&self) -> bool

Source

pub fn may_flush(&self) -> bool

Source

pub fn may_enqueue_more_ops(&self) -> bool

Source

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

Source

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

Source

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

Writes the next chunk of data to the socket.

It returns the number of bytes that have been written.

§Errors

An I/O error is returned if it is not possible to write to the socket.

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.

Source

pub fn socket(&self) -> &S

Source

pub fn socket_mut(&mut self) -> &mut S

Source

pub fn replace_socket<F, S2>(self, replacer: F) -> StreamingConnection<S2>
where F: FnOnce(S) -> S2,

Source

pub fn into_inner(self) -> S

Trait Implementations§

Source§

impl<S: Debug> Debug for StreamingConnection<S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> !Freeze for StreamingConnection<S>

§

impl<S> RefUnwindSafe for StreamingConnection<S>
where S: RefUnwindSafe,

§

impl<S> Send for StreamingConnection<S>
where S: Send,

§

impl<S> Sync for StreamingConnection<S>
where S: Sync,

§

impl<S> Unpin for StreamingConnection<S>
where S: Unpin,

§

impl<S> UnwindSafe for StreamingConnection<S>
where S: 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,