Skip to main content

InterfaceFactory

Trait InterfaceFactory 

Source
pub trait InterfaceFactory: Send + Sync {
    // Required methods
    fn type_name(&self) -> &str;
    fn parse_config(
        &self,
        name: &str,
        id: InterfaceId,
        params: &HashMap<String, String>,
    ) -> Result<Box<dyn InterfaceConfigData>, String>;
    fn start(
        &self,
        config: Box<dyn InterfaceConfigData>,
        ctx: StartContext,
    ) -> Result<StartResult>;

    // Provided method
    fn default_ifac_size(&self) -> usize { ... }
}
Expand description

Factory that can parse config and start an interface type.

Required Methods§

Source

fn type_name(&self) -> &str

Config-file type name, e.g. “TCPClientInterface”.

Source

fn parse_config( &self, name: &str, id: InterfaceId, params: &HashMap<String, String>, ) -> Result<Box<dyn InterfaceConfigData>, String>

Parse from key-value params (config file or external).

Source

fn start( &self, config: Box<dyn InterfaceConfigData>, ctx: StartContext, ) -> Result<StartResult>

Start the interface from parsed config.

Provided Methods§

Source

fn default_ifac_size(&self) -> usize

Default IFAC size (bytes). 8 for serial/kiss/rnode, 16 for others.

Implementors§