pub trait SystemInput: Sized {
type Param<'i>: SystemInput;
type Inner<'i>;
// Required method
fn wrap(this: Self::Inner<'_>) -> Self::Param<'_>;
}
Expand description
Trait for types that can be used as input to System
s.
Provided implementations are:
()
: No inputIn<T>
: For valuesInRef<T>
: For read-only references to valuesInMut<T>
: For mutable references to valuesTrigger<E, B>
: ForObserverSystem
sStaticSystemInput<I>
: For arbitrarySystemInput
s in generic contexts- Tuples of
SystemInput
s up to 8 elements
For advanced usecases, you can implement this trait for your own types.
§Examples
§Tuples of SystemInput
s
use bevy_ecs::prelude::*;
fn add((InMut(a), In(b)): (InMut<usize>, In<usize>)) {
*a += b;
}
Required Associated Types§
Sourcetype Param<'i>: SystemInput
type Param<'i>: SystemInput
The wrapper input type that is defined as the first argument to FunctionSystem
s.
Sourcetype Inner<'i>
type Inner<'i>
The inner input type that is passed to functions that run systems,
such as System::run
.
Required Methods§
Sourcefn wrap(this: Self::Inner<'_>) -> Self::Param<'_>
fn wrap(this: Self::Inner<'_>) -> Self::Param<'_>
Converts a SystemInput::Inner
into a SystemInput::Param
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl SystemInput for ()
impl SystemInput for ()
Source§impl<I: SystemInput> SystemInput for (I₁, I₂, …, Iₙ)
This trait is implemented for tuples up to 9 items long.
impl<I: SystemInput> SystemInput for (I₁, I₂, …, Iₙ)
This trait is implemented for tuples up to 9 items long.
Implementors§
Source§impl<'a, I: SystemInput> SystemInput for StaticSystemInput<'a, I>
impl<'a, I: SystemInput> SystemInput for StaticSystemInput<'a, I>
type Param<'i> = StaticSystemInput<'i, I>
type Inner<'i> = <I as SystemInput>::Inner<'i>
Source§impl<E: 'static, B: Bundle> SystemInput for Trigger<'_, E, B>
Used for ObserverSystem
s.
impl<E: 'static, B: Bundle> SystemInput for Trigger<'_, E, B>
Used for ObserverSystem
s.