pub struct Backend { /* private fields */ }Expand description
A plugin that is loaded and has passed the identity check.
It holds the library open, so every function pointer in its tables stays valid for as long as this value lives.
Implementations§
Source§impl Backend
impl Backend
Sourcepub fn load(
identity: &PluginIdentity,
library: &Path,
levels: Levels,
events: &mut dyn FnMut(Event),
) -> Result<Self, EngineError>
pub fn load( identity: &PluginIdentity, library: &Path, levels: Levels, events: &mut dyn FnMut(Event), ) -> Result<Self, EngineError>
Open the plugin’s library, check what it says about itself, and hand it the host’s hooks.
library is the file the store found for this plugin; this crate does not search for it, because
only the store knows how a plugin’s directory is laid out.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The name the plugin reports for itself, which the manifest has already been checked against.
Sourcepub fn build_info(&self) -> (String, String)
pub fn build_info(&self) -> (String, String)
The rustc version and target the plugin was built with. Diagnostics only.
Sourcepub fn wanted_files(&self) -> &[String]
pub fn wanted_files(&self) -> &[String]
The files the manifest declared this plugin may be handed.
Sourcepub fn hooks(levels: Levels) -> &'static PmpxHost
pub fn hooks(levels: Levels) -> &'static PmpxHost
The host’s hooks, for a caller that wants to attach them itself.
Sourcepub fn command(
&self,
call: &Call<'_>,
events: &mut dyn FnMut(Event),
) -> Result<CommandSpec, CallError>
pub fn command( &self, call: &Call<'_>, events: &mut dyn FnMut(Event), ) -> Result<CommandSpec, CallError>
Ask the plugin to map one call to one command.
A CallError is a business answer – “I cannot do that” – not a failure of the crossing
itself, which is why it is returned rather than raised. Everything the plugin said while it ran
(its debug! lines, what the file provider refused) reaches events.