Skip to main content

Backend

Trait Backend 

Source
pub trait Backend:
    Debug
    + Send
    + Sync {
    // Required methods
    fn connect(&self, itr: &str) -> BoxFuture<'_, Result<Arc<dyn BackendDev>>>;
    fn connect_at(
        &self,
        host: &str,
        port: u16,
        name: &str,
    ) -> BoxFuture<'_, Result<Arc<dyn BackendDev>>>;
    fn serve<'a>(
        &'a self,
        config: &'a BackendServerConfig,
    ) -> BoxFuture<'a, Result<Arc<dyn BackendServer>>>;
}
Expand description

A protocol: how devices are reached, and how they are served.

Required Methods§

Source

fn connect(&self, itr: &str) -> BoxFuture<'_, Result<Arc<dyn BackendDev>>>

Use this backend to connect to a device given its ITR (Interoperable Tango Reference). If the backend does not support this type of ITR, then it returns ErrorKind::NotHandled.

Source

fn connect_at( &self, host: &str, port: u16, name: &str, ) -> BoxFuture<'_, Result<Arc<dyn BackendDev>>>

Use this backend to connect to a device given its name, and the host/port of the service running the device server.

Source

fn serve<'a>( &'a self, config: &'a BackendServerConfig, ) -> BoxFuture<'a, Result<Arc<dyn BackendServer>>>

Start serving with this protocol, as configured, resolving to the server once it is listening: see BackendServer::host and BackendServer::port for where it ends up.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§