pub struct In<In>(pub In);
Expand description
Wrapper type to mark a SystemParam
as an input.
System
s may take an optional input which they require to be passed to them when they
are being run
. For FunctionSystems
the input may be marked
with this In
type, but only the first param of a function may be tagged as an input. This also
means a system can only have one or zero input parameters.
§Examples
Here is a simple example of a system that takes a usize
returning the square of it.
use bevy_ecs::prelude::*;
fn main() {
let mut square_system = IntoSystem::into_system(square);
let mut world = World::default();
square_system.initialize(&mut world);
assert_eq!(square_system.run(12, &mut world), 144);
}
fn square(In(input): In<usize>) -> usize {
input * input
}
Tuple Fields§
§0: In
Trait Implementations§
Auto Trait Implementations§
impl<In> Freeze for In<In>where
In: Freeze,
impl<In> RefUnwindSafe for In<In>where
In: RefUnwindSafe,
impl<In> Send for In<In>where
In: Send,
impl<In> Sync for In<In>where
In: Sync,
impl<In> Unpin for In<In>where
In: Unpin,
impl<In> UnwindSafe for In<In>where
In: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more