Skip to main content

Driver

Struct Driver 

Source
pub struct Driver<S, C: SansIo> { /* private fields */ }
Expand description

A shared sans-I/O driver. Protocol crates only implement SansIo; transport flushing, partial input, cancellation and read scheduling live here once.

Implementations§

Source§

impl<S: Stream, C: SansIo> Driver<S, C>

Source

pub fn new(stream: S, core: C) -> Self

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.

Source

pub fn into_parts(self) -> Result<(S, C, Vec<u8>)>

Transfer a validated TLS-upgrade boundary, including unread transport data.

Trait Implementations§

Source§

impl<S, C: SansIo> Drop for Driver<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<S, C> Forget for Driver<S, C>

§

impl<S, C> Freeze for Driver<S, C>
where Option<S>: Freeze, Option<C>: Freeze,

§

impl<S, C> RefUnwindSafe for Driver<S, C>

§

impl<S, C> Send for Driver<S, C>
where Option<S>: Send, Option<C>: Send,

§

impl<S, C> Sync for Driver<S, C>
where Option<S>: Sync, Option<C>: Sync,

§

impl<S, C> Unpin for Driver<S, C>
where Option<S>: Unpin, Option<C>: Unpin,

§

impl<S, C> UnsafeUnpin for Driver<S, C>

§

impl<S, C> UnwindSafe for Driver<S, C>

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 = !

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.