pub struct Plugins {
pub functional_actions: FunctionalPluginActions,
pub control_actions: ControlPluginActions,
/* private fields */
}
Expand description
A representation of all the plugins used by an app.
Due to the sheer number and complexity of nested fields, this is best
transferred in an Rc
, which unfortunately results in double indirection
for runner functions.
Fields§
§functional_actions: FunctionalPluginActions
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§
source§impl Plugins
impl Plugins
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new instance of Plugins
, with no actions taken by any
plugins, and the data map empty.
sourcepub fn plugin<D: Any + Send + Sync>(
self,
plugin: impl Fn() -> Plugin<D> + Send + Sync,
plugin_data: D
) -> Self
pub fn plugin<D: Any + Send + Sync>( self, plugin: impl Fn() -> Plugin<D> + Send + Sync, plugin_data: D ) -> Self
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).
sourcepub fn plugin_with_client_privilege<D: Any + Send + Sync>(
self,
plugin: impl Fn() -> Plugin<D> + Send + Sync,
plugin_data: D
) -> Self
pub fn plugin_with_client_privilege<D: Any + Send + Sync>( self, plugin: impl Fn() -> Plugin<D> + Send + Sync, 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 increasing their
bundle sizes. Note that this should also be used for plugins that
run on both the client and server.