hyper_client_sockets/
lib.rs1#![cfg_attr(docsrs, feature(doc_cfg))]
2
3#[cfg(any(feature = "unix", feature = "vsock", feature = "firecracker"))]
4use std::future::Future;
5
6#[cfg(any(feature = "unix", feature = "firecracker"))]
7use std::path::Path;
8
9#[cfg(feature = "tokio-backend")]
10#[cfg_attr(docsrs, doc(cfg(feature = "tokio-backend")))]
11pub mod tokio;
12
13#[cfg(feature = "async-io-backend")]
14#[cfg_attr(docsrs, doc(cfg(feature = "async-io-backend")))]
15pub mod async_io;
16
17#[cfg(feature = "hyper-util")]
18#[cfg_attr(docsrs, doc(cfg(feature = "hyper-util")))]
19pub mod uri;
20
21#[cfg(feature = "hyper-util")]
22#[cfg_attr(docsrs, doc(cfg(feature = "hyper-util")))]
23pub mod connector;
24
25pub trait Backend: Clone {
27 #[cfg(feature = "unix")]
29 #[cfg_attr(docsrs, doc(cfg(feature = "unix")))]
30 type UnixIo: hyper::rt::Read + hyper::rt::Write + Send + Unpin;
31
32 #[cfg(feature = "vsock")]
34 #[cfg_attr(docsrs, doc(cfg(feature = "vsock")))]
35 type VsockIo: hyper::rt::Read + hyper::rt::Write + Send + Unpin;
36
37 #[cfg(feature = "firecracker")]
39 #[cfg_attr(docsrs, doc(cfg(feature = "firecracker")))]
40 type FirecrackerIo: hyper::rt::Read + hyper::rt::Write + Send + Unpin;
41
42 #[cfg(feature = "unix")]
44 #[cfg_attr(docsrs, doc(cfg(feature = "unix")))]
45 fn connect_to_unix_socket(socket_path: &Path) -> impl Future<Output = Result<Self::UnixIo, std::io::Error>> + Send;
46
47 #[cfg(feature = "vsock")]
49 #[cfg_attr(docsrs, doc(cfg(feature = "vsock")))]
50 fn connect_to_vsock_socket(
51 addr: vsock::VsockAddr,
52 ) -> impl Future<Output = Result<Self::VsockIo, std::io::Error>> + Send;
53
54 #[cfg(feature = "firecracker")]
57 #[cfg_attr(docsrs, doc(cfg(feature = "firecracker")))]
58 fn connect_to_firecracker_socket(
59 host_socket_path: &Path,
60 guest_port: u32,
61 ) -> impl Future<Output = Result<Self::FirecrackerIo, std::io::Error>> + Send;
62}