pub struct Plugin { /* private fields */ }Expand description
A composition of resource requirements and systems.
A plugin can contain duplicate entries of resources and systems. At the time
when the plugin is loaded into the world with
World::with_plugin, all resources and systems
will be created once and will be unique.
Implementations
sourceimpl Plugin
impl Plugin
pub fn with_plugin(self, plug: impl Into<Plugin>) -> Self
sourcepub fn with_resource<T: IsResource + Default>(self) -> Self
pub fn with_resource<T: IsResource + Default>(self) -> Self
Add a dependency on a resource that can be created with
Default::default.
If this resource does not already exist in the world at the time this
plugin is instantiated, it will be inserted into the
World.
sourcepub fn with_dependent_resource<S: CanFetch, T: IsResource>(
self,
create: impl FnOnce(S) -> Result<T> + 'static
) -> Self
pub fn with_dependent_resource<S: CanFetch, T: IsResource>(
self,
create: impl FnOnce(S) -> Result<T> + 'static
) -> Self
Add a dependency on a resource that may be created using other existing and fetchable resources.
If this resource does not already exist in the world at the time this
plugin is instantiated, it will be inserted into the
World, if possible - otherwise instantiation will
err.
sourcepub fn with_system<T: CanFetch + Send + Sync + 'static>(
self,
name: &str,
system: impl FnMut(T) -> Result<ShouldContinue> + Send + Sync + 'static,
after_deps: &[&str],
before_deps: &[&str]
) -> Self
pub fn with_system<T: CanFetch + Send + Sync + 'static>(
self,
name: &str,
system: impl FnMut(T) -> Result<ShouldContinue> + Send + Sync + 'static,
after_deps: &[&str],
before_deps: &[&str]
) -> Self
Add a system to the plugin.