pub struct Plugin<G: Html, D: Any + Send> {
pub name: String,
pub functional_actions_registrar: Box<dyn Fn(FunctionalPluginActions<G>) -> FunctionalPluginActions<G>>,
pub control_actions_registrar: Box<dyn Fn(ControlPluginActions) -> ControlPluginActions>,
pub env: PluginEnv,
/* private fields */
}
Expand description
A Perseus plugin. This must be exported by all plugin crates so the user can register the plugin easily.
Fields
name: String
The machine name of the plugin, which will be used as a key in a HashMap with many other plugins. This should be the public crate name in all cases.
functional_actions_registrar: Box<dyn Fn(FunctionalPluginActions<G>) -> FunctionalPluginActions<G>>
A function that will be provided functional actions. It should then register runners from the plugin for every action that it takes.
control_actions_registrar: Box<dyn Fn(ControlPluginActions) -> ControlPluginActions>
A function that will be provided control actions. It should then register runners from the plugin for every action that it takes.
env: PluginEnv
The environment that the plugin should run in.
Implementations
sourceimpl<G: Html, D: Any + Send> Plugin<G, D>
impl<G: Html, D: Any + Send> Plugin<G, D>
sourcepub fn new(
name: &str,
functional_actions_registrar: impl Fn(FunctionalPluginActions<G>) -> FunctionalPluginActions<G> + 'static,
control_actions_registrar: impl Fn(ControlPluginActions) -> ControlPluginActions + 'static,
env: PluginEnv
) -> Self
pub fn new(
name: &str,
functional_actions_registrar: impl Fn(FunctionalPluginActions<G>) -> FunctionalPluginActions<G> + 'static,
control_actions_registrar: impl Fn(ControlPluginActions) -> ControlPluginActions + 'static,
env: PluginEnv
) -> Self
Creates a new plugin with a name, functional actions, control actions, and whether or not the plugin is tinker-only.
Trait Implementations
Auto Trait Implementations
impl<G, D> !RefUnwindSafe for Plugin<G, D>
impl<G, D> !Send for Plugin<G, D>
impl<G, D> !Sync for Plugin<G, D>
impl<G, D> Unpin for Plugin<G, D> where
D: Unpin,
impl<G, D> !UnwindSafe for Plugin<G, D>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more