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 and will be unique.
Implementations
sourceimpl Plugin
impl Plugin
pub fn with_plugin(self, plug: impl Into<Plugin>) -> Self
sourcepub fn with_default_resource<T: IsResource + Default>(self) -> Self
pub fn with_default_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_lazy_resource<T: IsResource>(
self,
create: impl FnOnce() -> T + 'static
) -> Self
pub fn with_lazy_resource<T: IsResource>(
self,
create: impl FnOnce() -> T + 'static
) -> Self
Add a dependency on a resource that can be created lazily with a closure.
If a resource of this type does not already exist in the world at the
time the plugin is instantiated, it will be inserted into the
World.
sourcepub fn with_expected_resource<T: IsResource>(self) -> Self
pub fn with_expected_resource<T: IsResource>(self) -> Self
Add a dependency on a resource that must already exist in the
World at the time of plugin instantiation.
If this resource does not already exist in the world at the time this plugin is instantiated, adding the plugin 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.
pub fn with_async_system<Fut>(
self,
name: &str,
system: impl FnOnce(Facade) -> Fut + 'static
) -> Selfwhere
Fut: Future<Output = Result<()>> + Send + Sync + 'static,
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Plugin
impl !Send for Plugin
impl !Sync for Plugin
impl Unpin for Plugin
impl !UnwindSafe for Plugin
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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