Skip to main content

Exchange

Struct Exchange 

Source
pub struct Exchange<'a, S: Stream, C: SansIo> { /* private fields */ }
Expand description

Dropping an unfinished operation aborts both its protocol and transport.

Implementations§

Source§

impl<S: Stream, C: SansIo> Exchange<'_, S, C>

Source

pub fn commit(&mut self)

Methods from Deref<Target = Driver<S, C>>§

Source

pub fn core(&self) -> &C

Source

pub fn core_mut(&mut self) -> &mut C

Source

pub fn is_connected(&self) -> bool

Source

pub fn stream(&self) -> Option<&S>

Source

pub fn abort(&mut self)

Close immediately. Submitted transport storage remains owned by AsyncIo.

Source

pub fn replace_stream(&mut self, stream: S) -> Result<()>

Install a new transport after the protocol has entered its reconnect state. Bytes from the failed transport are never fed to the new session.

Source

pub fn exchange(&mut self) -> Exchange<'_, S, C>

Guard a complete operation, including pauses between protocol events.

Source

pub fn upgrade_stream(&mut self) -> Result<&mut S>

A TLS transition is legal only at a drained plaintext boundary.

Source

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

Flush COPY or other output that has no corresponding input event.

Source

pub async fn next<B: Backend>( &mut self, executor: &ExecutorHandle<B>, receive: impl FnMut(C::Event<'_>) -> Result<()>, ) -> Result<()>

Drive until one protocol event is delivered. Wrap this in deadline for the protocol’s advertised timeout; cancellation closes and aborts the core.

Trait Implementations§

Source§

impl<S: Stream, C: SansIo> Deref for Exchange<'_, S, C>

Source§

type Target = Driver<S, C>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<S: Stream, C: SansIo> DerefMut for Exchange<'_, S, C>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<S: Stream, C: SansIo> Drop for Exchange<'_, S, C>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a, S, C> !UnwindSafe for Exchange<'a, S, C>

§

impl<'a, S, C> Forget for Exchange<'a, S, C>

§

impl<'a, S, C> Freeze for Exchange<'a, S, C>
where &'a mut Driver<S, C>: Freeze,

§

impl<'a, S, C> RefUnwindSafe for Exchange<'a, S, C>
where &'a mut Driver<S, C>: RefUnwindSafe,

§

impl<'a, S, C> Send for Exchange<'a, S, C>
where &'a mut Driver<S, C>: Send,

§

impl<'a, S, C> Sync for Exchange<'a, S, C>
where &'a mut Driver<S, C>: Sync,

§

impl<'a, S, C> Unpin for Exchange<'a, S, C>
where &'a mut Driver<S, C>: Unpin,

§

impl<'a, S, C> UnsafeUnpin for Exchange<'a, S, C>
where &'a mut Driver<S, C>: UnsafeUnpin,

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.