Struct perseus::Plugins [−][src]
pub struct Plugins<G: Html> {
pub functional_actions: FunctionalPluginActions<G>,
pub control_actions: ControlPluginActions,
// some fields omitted
}
Expand description
A representation of all the plugins used by an app. Due to the sheer number and compexity of nested fields, this is best transferred
in an Rc
, which unfortunately results in double indirection for runner functions.
Fields
functional_actions: FunctionalPluginActions<G>
The functional actions that this plugin takes. This is defined by default such that all actions are assigned to a default, and
so they can all be run without long chains of matching Option<T>
s.
control_actions: ControlPluginActions
The control actions that this plugin takes. This is defined by default such that all actions are assigned to a default, and so
they can all be run without long chains of matching Option<T>
s.
Implementations
Creates a new instance of Plugins
, with no actions taken by any plugins, and the data map empty.
Registers a new plugin, consuming self
. For control actions, this will check if a plugin has already registered on an action,
and throw an error if one has, noting the conflict explicitly in the error message. This can only register plugins that run
exclusively on the server-side (including tinker-time and the build process).
pub fn plugin_with_client_privilege<D: Any>(
self,
plugin: impl Fn() -> Plugin<G, D>,
plugin_data: D
) -> Self
pub fn plugin_with_client_privilege<D: Any>(
self,
plugin: impl Fn() -> Plugin<G, D>,
plugin_data: D
) -> Self
The same as .plugin()
, but registers a plugin that can run on the client-side. This is deliberately separated out to make
conditional compilation feasible and to emphasize to users what’s incrasing their bundle sizes. Note that this should also
be used for plugins that run on both the client and server.