Skip to main content

PluginConnection

Trait PluginConnection 

Source
pub trait PluginConnection: Plugin {
    // Required methods
    fn create(&self, key: &ConnectionKey) -> Box<dyn PluginConnection>;
    fn open<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        params: &'life1 ResolvedConnectionParams,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn close(&mut self) -> ConnectionKey;
    fn is_alive(&self) -> bool;

    // Provided methods
    fn execute_command<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _command: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn group(&self) -> String { ... }
}
Expand description

Manages device connections for plugins that need an explicit session.

Connection plugins provide lifecycle hooks for establishing and tearing down connections and expose a connection operation for downstream use.

Required Methods§

Source

fn create(&self, key: &ConnectionKey) -> Box<dyn PluginConnection>

Create a new per-host connection instance.

Source

fn open<'life0, 'life1, 'async_trait>( &'life0 mut self, params: &'life1 ResolvedConnectionParams, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open a connection to a device.

Source

fn close(&mut self) -> ConnectionKey

Close a connection to a device.

Source

fn is_alive(&self) -> bool

Returns true if the connection is alive.

Provided Methods§

Source

fn execute_command<'life0, 'life1, 'async_trait>( &'life0 mut self, _command: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn group(&self) -> String

Returns the group name

Trait Implementations§

Source§

impl Debug for dyn PluginConnection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§