Skip to main content

NetCapability

Trait NetCapability 

Source
pub trait NetCapability {
    type Handle: Send + Unpin;
    type Reader: Send + Unpin;
    type Writer: Send + Unpin;
    type Error: Into<GuestError>;

    // Required methods
    fn create(
        &self,
        protocol: NetProtocol,
        domain: &str,
        port: u16,
        tls: Option<Arc<TlsServerConfig>>,
    ) -> BoxFuture<'_, Result<Self::Handle, Self::Error>>;
    fn connect(
        &self,
        protocol: NetProtocol,
        domain: &str,
        port: u16,
        tls: Option<Arc<TlsClientConfig>>,
    ) -> BoxFuture<'_, Result<(Self::Reader, Self::Writer, String), Self::Error>>;
    fn accept(
        &self,
        handle: &Self::Handle,
    ) -> BoxFuture<'_, Result<(Self::Reader, Self::Writer, String), Self::Error>>;
}

Required Associated Types§

Required Methods§

Source

fn create( &self, protocol: NetProtocol, domain: &str, port: u16, tls: Option<Arc<TlsServerConfig>>, ) -> BoxFuture<'_, Result<Self::Handle, Self::Error>>

Creates a new network listener for the selected protocol, returning a handle to the listener.

Source

fn connect( &self, protocol: NetProtocol, domain: &str, port: u16, tls: Option<Arc<TlsClientConfig>>, ) -> BoxFuture<'_, Result<(Self::Reader, Self::Writer, String), Self::Error>>

Connect to a remote listener for the selected protocol, returning bidirectional comms.

Source

fn accept( &self, handle: &Self::Handle, ) -> BoxFuture<'_, Result<(Self::Reader, Self::Writer, String), Self::Error>>

Accept a new inbound connection for the listener represented by handle.

Implementations on Foreign Types§

Source§

impl<T> NetCapability for Arc<T>
where T: NetCapability,

Source§

type Handle = <T as NetCapability>::Handle

Source§

type Reader = <T as NetCapability>::Reader

Source§

type Writer = <T as NetCapability>::Writer

Source§

type Error = <T as NetCapability>::Error

Source§

fn create( &self, protocol: NetProtocol, domain: &str, port: u16, tls: Option<Arc<TlsServerConfig>>, ) -> BoxFuture<'_, Result<Self::Handle, Self::Error>>

Source§

fn connect( &self, protocol: NetProtocol, domain: &str, port: u16, tls: Option<Arc<TlsClientConfig>>, ) -> BoxFuture<'_, Result<(Self::Reader, Self::Writer, String), Self::Error>>

Source§

fn accept( &self, handle: &Self::Handle, ) -> BoxFuture<'_, Result<(Self::Reader, Self::Writer, String), Self::Error>>

Implementors§