pub struct Plugins<G: Html> {
pub functional_actions: FunctionalPluginActions<G>,
pub control_actions: ControlPluginActions,
/* private fields */
}
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
sourceimpl<G: Html> Plugins<G>
impl<G: Html> Plugins<G>
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>(
self,
plugin: impl Fn() -> Plugin<G, D> + Send,
plugin_data: D
) -> Self
pub fn plugin<D: Any + Send>(
self,
plugin: impl Fn() -> Plugin<G, D> + Send,
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>(
self,
plugin: impl Fn() -> Plugin<G, D> + Send,
plugin_data: D
) -> Self
pub fn plugin_with_client_privilege<D: Any + Send>(
self,
plugin: impl Fn() -> Plugin<G, D> + Send,
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.
Trait Implementations
Auto Trait Implementations
impl<G> !RefUnwindSafe for Plugins<G>
impl<G> Send for Plugins<G>
impl<G> !Sync for Plugins<G>
impl<G> Unpin for Plugins<G>
impl<G> !UnwindSafe for Plugins<G>
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