pub trait VsockStreamBackend: Send {
// Required methods
fn read(&self, buf: &mut [u8]) -> Result<usize, Error>;
fn write(&self, buf: &[u8]) -> Result<usize, Error>;
fn shutdown(&self, how: VsockShutdown) -> Result<(), Error>;
// Provided methods
fn connect_state(&self) -> Result<VsockConnectState, Error> { ... }
fn pollable(&self) -> Option<i32> { ... }
}Expand description
One nonblocking byte stream served by a custom vsock backend.
Implementations return io::ErrorKind::WouldBlock when progress is not
currently possible. The VsockNotifier supplied at connection time must
be signaled whenever a blocked operation may make progress; libkrun
continues to own virtio-vsock framing, credit flow, shutdown, and reset
handling around this stream.
Required Methods§
Provided Methods§
Sourcefn connect_state(&self) -> Result<VsockConnectState, Error>
fn connect_state(&self) -> Result<VsockConnectState, Error>
Report whether a nonblocking host connection has completed.
In-process backends are ready immediately. Socket-backed implementations
can return VsockConnectState::Connecting until their poll fd becomes
writable and then surface the result of SO_ERROR here.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".