Skip to main content

Backend

Struct Backend 

Source
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

Source

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.

Source

pub fn name(&self) -> &str

The name the plugin reports for itself, which the manifest has already been checked against.

Source

pub fn family(&self) -> String

The family the plugin reports for itself.

Source

pub fn build_info(&self) -> (String, String)

The rustc version and target the plugin was built with. Diagnostics only.

Source

pub fn wanted_files(&self) -> &[String]

The files the manifest declared this plugin may be handed.

Source

pub fn hooks(levels: Levels) -> &'static PmpxHost

The host’s hooks, for a caller that wants to attach them itself.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.