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>
impl<S: Stream, C: SansIo> Driver<S, C>
pub fn new(stream: S, core: C) -> Self
pub fn core(&self) -> &C
pub fn core_mut(&mut self) -> &mut C
pub fn is_connected(&self) -> bool
pub fn stream(&self) -> Option<&S>
Sourcepub fn abort(&mut self)
pub fn abort(&mut self)
Close immediately. Submitted transport storage remains owned by AsyncIo.
Sourcepub fn replace_stream(&mut self, stream: S) -> Result<()>
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.
Sourcepub fn exchange(&mut self) -> Exchange<'_, S, C>
pub fn exchange(&mut self) -> Exchange<'_, S, C>
Guard a complete operation, including pauses between protocol events.
Sourcepub fn upgrade_stream(&mut self) -> Result<&mut S>
pub fn upgrade_stream(&mut self) -> Result<&mut S>
A TLS transition is legal only at a drained plaintext boundary.
Sourcepub async fn flush(&mut self) -> Result<()>
pub async fn flush(&mut self) -> Result<()>
Flush COPY or other output that has no corresponding input event.
Sourcepub async fn next<B: Backend>(
&mut self,
executor: &ExecutorHandle<B>,
receive: impl FnMut(C::Event<'_>) -> Result<()>,
) -> Result<()>
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.
Sourcepub fn into_parts(self) -> Result<(S, C, Vec<u8>)>
pub fn into_parts(self) -> Result<(S, C, Vec<u8>)>
Transfer a validated TLS-upgrade boundary, including unread transport data.