Trait Backend

Source
pub trait Backend: Clone {
    type UnixIo: Read + Write + Send + Unpin;
    type VsockIo: Read + Write + Send + Unpin;
    type FirecrackerIo: Read + Write + Send + Unpin;

    // Required methods
    fn connect_to_unix_socket(
        socket_path: &Path,
    ) -> impl Future<Output = Result<Self::UnixIo, Error>> + Send;
    fn connect_to_vsock_socket(
        addr: VsockAddr,
    ) -> impl Future<Output = Result<Self::VsockIo, Error>> + Send;
    fn connect_to_firecracker_socket(
        host_socket_path: &Path,
        guest_port: u32,
    ) -> impl Future<Output = Result<Self::FirecrackerIo, Error>> + Send;
}
Expand description

A Backend is a runtime- and reactor-agnostic way to use hyper client-side with various types of sockets.

Required Associated Types§

Source

type UnixIo: Read + Write + Send + Unpin

Available on crate feature unix only.

An IO object representing a connected Unix socket.

Source

type VsockIo: Read + Write + Send + Unpin

Available on crate feature vsock only.

An IO object representing a connected virtio-vsock socket.

Source

type FirecrackerIo: Read + Write + Send + Unpin

Available on crate feature firecracker only.

An IO object representing a connected Firecracker socket (a specialized Unix socket).

Required Methods§

Source

fn connect_to_unix_socket( socket_path: &Path, ) -> impl Future<Output = Result<Self::UnixIo, Error>> + Send

Available on crate feature unix only.

Connect to a Unix socket at the given Path.

Source

fn connect_to_vsock_socket( addr: VsockAddr, ) -> impl Future<Output = Result<Self::VsockIo, Error>> + Send

Available on crate feature vsock only.

Connect to a virtio-vsock socket at the given vsock address.

Source

fn connect_to_firecracker_socket( host_socket_path: &Path, guest_port: u32, ) -> impl Future<Output = Result<Self::FirecrackerIo, Error>> + Send

Available on crate feature firecracker only.

Connect to a Firecracker socket at the given Path, establishing a tunnel to the given guest vsock port.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Backend for AsyncIoBackend

Available on crate feature async-io-backend only.
Source§

impl Backend for TokioBackend

Available on crate feature tokio-backend only.