[][src]Trait dqcsim::host::plugin::Plugin

pub trait Plugin: Debug {
    fn spawn(&mut self, logger: &LogThread) -> Result<()>;
fn plugin_type(&self) -> PluginType;
fn init_cmds(&self) -> Vec<ArbCmd>;
fn log_configuration(&self) -> PluginLogConfiguration;
fn rpc(&mut self, msg: SimulatorToPlugin) -> Result<PluginToSimulator>; }

The Plugin trait, implemented by all Plugins used in a Simulation.

Required methods

fn spawn(&mut self, logger: &LogThread) -> Result<()>

Spawn the Plugin. The Plugin should spawn the actual plugin code and prepare the communication channel. After spawning the [rpc] method should be available. The simulator will continue to send initialization requests via the commmunication channel.

The logger is provided by the simulator, and plugins can use the reference to the log thread to make the neccesary copies of log senders to use with their log proxies.

fn plugin_type(&self) -> PluginType

Returns the PluginType of this plugin.

fn init_cmds(&self) -> Vec<ArbCmd>

Returns the vector of ArbCmds that are to be passed to the plugin's initialize() callback.

fn log_configuration(&self) -> PluginLogConfiguration

Returns the logging configuration for this plugin.

fn rpc(&mut self, msg: SimulatorToPlugin) -> Result<PluginToSimulator>

Send the SimulatorToPlugin message to the plugin.

Loading content...

Implementations

impl dyn Plugin[src]

pub fn name(&self) -> String[src]

Returns the name of this plugin from its logging configuration.

pub fn initialize(
    &mut self,
    logger: &LogThread,
    downstream: &Option<String>,
    seed: u64
) -> Result<PluginInitializeResponse>
[src]

Sends an PluginInitializeRequest to this plugin.

pub fn accept_upstream(&mut self) -> Result<()>[src]

Requests that the plugin waits for the upstream plugin to connect and establishes the connection.

pub fn user_initialize(&mut self) -> Result<()>[src]

Send user initialize request to the plugin. This invokes the initialize callback with the user initialize commands.

pub fn arb(&mut self, cmd: impl Into<ArbCmd>) -> Result<ArbData>[src]

Sends an ArbCmd message to this plugin.

Implementors

impl Plugin for PluginProcess[src]

fn spawn(&mut self, logger: &LogThread) -> Result<()>[src]

Spawn the child process based on the plugin configuration. The simulator address is passed as the first argument to the child process, or as the 2nd argument to the interpreter when the configuration specifies a script.

impl Plugin for PluginThread[src]

Loading content...