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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.