pub struct Gamepad { /* private fields */ }Expand description
Stores a connected gamepad’s metadata such as the name and its GamepadButton and GamepadAxis.
An entity with this component is spawned automatically after GamepadConnectionEvent
and updated by gamepad_event_processing_system.
See also GamepadSettings for configuration.
§Examples
fn gamepad_usage_system(gamepads: Query<(&Name, &Gamepad)>) {
for (name, gamepad) in &gamepads {
println!("{name}");
if gamepad.just_pressed(GamepadButton::North) {
println!("{} just pressed North", name)
}
if let Some(left_stick_x) = gamepad.get(GamepadAxis::LeftStickX) {
println!("left stick X: {}", left_stick_x)
}
}
}Implementations§
Source§impl Gamepad
impl Gamepad
Sourcepub fn vendor_id(&self) -> Option<u16>
pub fn vendor_id(&self) -> Option<u16>
Returns the USB vendor ID as assigned by the USB-IF, if available.
Sourcepub fn product_id(&self) -> Option<u16>
pub fn product_id(&self) -> Option<u16>
Returns the USB product ID as assigned by the vendor, if available.
Sourcepub fn get(&self, input: impl Into<GamepadInput>) -> Option<f32>
pub fn get(&self, input: impl Into<GamepadInput>) -> Option<f32>
Returns the analog data of the provided GamepadAxis or GamepadButton.
Examples found in repository?
12fn gamepad_system(gamepads: Query<(Entity, &Gamepad)>) {
13 for (entity, gamepad) in &gamepads {
14 if gamepad.just_pressed(GamepadButton::South) {
15 info!("{} just pressed South", entity);
16 } else if gamepad.just_released(GamepadButton::South) {
17 info!("{} just released South", entity);
18 }
19
20 let right_trigger = gamepad.get(GamepadButton::RightTrigger2).unwrap();
21 if right_trigger.abs() > 0.01 {
22 info!("{} RightTrigger2 value is {}", entity, right_trigger);
23 }
24
25 let left_stick_x = gamepad.get(GamepadAxis::LeftStickX).unwrap();
26 if left_stick_x.abs() > 0.01 {
27 info!("{} LeftStickX value is {}", entity, left_stick_x);
28 }
29 }
30}Sourcepub fn get_unclamped(&self, input: impl Into<GamepadInput>) -> Option<f32>
pub fn get_unclamped(&self, input: impl Into<GamepadInput>) -> Option<f32>
Returns the unclamped analog data of the provided GamepadAxis or GamepadButton.
This value may be outside the Axis::MIN and Axis::MAX range.
Sourcepub fn left_stick(&self) -> Vec2
pub fn left_stick(&self) -> Vec2
Returns the left stick as a Vec2.
Sourcepub fn right_stick(&self) -> Vec2
pub fn right_stick(&self) -> Vec2
Returns the right stick as a Vec2.
Sourcepub fn pressed(&self, button_type: GamepadButton) -> bool
pub fn pressed(&self, button_type: GamepadButton) -> bool
Returns true if the GamepadButton has been pressed.
Sourcepub fn any_pressed(
&self,
button_inputs: impl IntoIterator<Item = GamepadButton>,
) -> bool
pub fn any_pressed( &self, button_inputs: impl IntoIterator<Item = GamepadButton>, ) -> bool
Returns true if any item in the GamepadButton iterator has been pressed.
Sourcepub fn all_pressed(
&self,
button_inputs: impl IntoIterator<Item = GamepadButton>,
) -> bool
pub fn all_pressed( &self, button_inputs: impl IntoIterator<Item = GamepadButton>, ) -> bool
Returns true if all items in the GamepadButton iterator have been pressed.
Sourcepub fn just_pressed(&self, button_type: GamepadButton) -> bool
pub fn just_pressed(&self, button_type: GamepadButton) -> bool
Returns true if the GamepadButton has been pressed during the current frame.
Note: This function does not imply information regarding the current state of ButtonInput::pressed or ButtonInput::just_released.
Examples found in repository?
12fn gamepad_system(gamepads: Query<(Entity, &Gamepad)>) {
13 for (entity, gamepad) in &gamepads {
14 if gamepad.just_pressed(GamepadButton::South) {
15 info!("{} just pressed South", entity);
16 } else if gamepad.just_released(GamepadButton::South) {
17 info!("{} just released South", entity);
18 }
19
20 let right_trigger = gamepad.get(GamepadButton::RightTrigger2).unwrap();
21 if right_trigger.abs() > 0.01 {
22 info!("{} RightTrigger2 value is {}", entity, right_trigger);
23 }
24
25 let left_stick_x = gamepad.get(GamepadAxis::LeftStickX).unwrap();
26 if left_stick_x.abs() > 0.01 {
27 info!("{} LeftStickX value is {}", entity, left_stick_x);
28 }
29 }
30}More examples
281fn process_inputs(
282 mut action_state: ResMut<ActionState>,
283 keyboard_input: Res<ButtonInput<KeyCode>>,
284 gamepad_input: Query<&Gamepad>,
285) {
286 // Reset the set of pressed actions each frame
287 // to ensure that we only process each action once
288 action_state.pressed_actions.clear();
289
290 for action in DirectionalNavigationAction::variants() {
291 // Use just_pressed to ensure that we only process each action once
292 // for each time it is pressed
293 if keyboard_input.just_pressed(action.keycode()) {
294 action_state.pressed_actions.insert(action);
295 }
296 }
297
298 // We're treating this like a single-player game:
299 // if multiple gamepads are connected, we don't care which one is being used
300 for gamepad in gamepad_input.iter() {
301 for action in DirectionalNavigationAction::variants() {
302 // Unlike keyboard input, gamepads are bound to a specific controller
303 if gamepad.just_pressed(action.gamepad_button()) {
304 action_state.pressed_actions.insert(action);
305 }
306 }
307 }
308}17fn gamepad_system(
18 gamepads: Query<(Entity, &Gamepad)>,
19 mut rumble_requests: MessageWriter<GamepadRumbleRequest>,
20) {
21 for (entity, gamepad) in &gamepads {
22 if gamepad.just_pressed(GamepadButton::North) {
23 info!(
24 "North face button: strong (low-frequency) with low intensity for rumble for 5 seconds. Press multiple times to increase intensity."
25 );
26 rumble_requests.write(GamepadRumbleRequest::Add {
27 gamepad: entity,
28 intensity: GamepadRumbleIntensity::strong_motor(0.1),
29 duration: Duration::from_secs(5),
30 });
31 }
32
33 if gamepad.just_pressed(GamepadButton::East) {
34 info!("East face button: maximum rumble on both motors for 5 seconds");
35 rumble_requests.write(GamepadRumbleRequest::Add {
36 gamepad: entity,
37 duration: Duration::from_secs(5),
38 intensity: GamepadRumbleIntensity::MAX,
39 });
40 }
41
42 if gamepad.just_pressed(GamepadButton::South) {
43 info!("South face button: low-intensity rumble on the weak motor for 0.5 seconds");
44 rumble_requests.write(GamepadRumbleRequest::Add {
45 gamepad: entity,
46 duration: Duration::from_secs_f32(0.5),
47 intensity: GamepadRumbleIntensity::weak_motor(0.25),
48 });
49 }
50
51 if gamepad.just_pressed(GamepadButton::West) {
52 info!("West face button: custom rumble intensity for 5 second");
53 rumble_requests.write(GamepadRumbleRequest::Add {
54 gamepad: entity,
55 intensity: GamepadRumbleIntensity {
56 // intensity low-frequency motor, usually on the left-hand side
57 strong_motor: 0.5,
58 // intensity of high-frequency motor, usually on the right-hand side
59 weak_motor: 0.25,
60 },
61 duration: Duration::from_secs(5),
62 });
63 }
64
65 if gamepad.just_pressed(GamepadButton::Start) {
66 info!("Start button: Interrupt the current rumble");
67 rumble_requests.write(GamepadRumbleRequest::Stop { gamepad: entity });
68 }
69 }
70}Sourcepub fn any_just_pressed(
&self,
button_inputs: impl IntoIterator<Item = GamepadButton>,
) -> bool
pub fn any_just_pressed( &self, button_inputs: impl IntoIterator<Item = GamepadButton>, ) -> bool
Returns true if any item in the GamepadButton iterator has been pressed during the current frame.
Sourcepub fn all_just_pressed(
&self,
button_inputs: impl IntoIterator<Item = GamepadButton>,
) -> bool
pub fn all_just_pressed( &self, button_inputs: impl IntoIterator<Item = GamepadButton>, ) -> bool
Returns true if all items in the GamepadButton iterator have been just pressed.
Sourcepub fn just_released(&self, button_type: GamepadButton) -> bool
pub fn just_released(&self, button_type: GamepadButton) -> bool
Returns true if the GamepadButton has been released during the current frame.
Note: This function does not imply information regarding the current state of ButtonInput::pressed or ButtonInput::just_pressed.
Examples found in repository?
12fn gamepad_system(gamepads: Query<(Entity, &Gamepad)>) {
13 for (entity, gamepad) in &gamepads {
14 if gamepad.just_pressed(GamepadButton::South) {
15 info!("{} just pressed South", entity);
16 } else if gamepad.just_released(GamepadButton::South) {
17 info!("{} just released South", entity);
18 }
19
20 let right_trigger = gamepad.get(GamepadButton::RightTrigger2).unwrap();
21 if right_trigger.abs() > 0.01 {
22 info!("{} RightTrigger2 value is {}", entity, right_trigger);
23 }
24
25 let left_stick_x = gamepad.get(GamepadAxis::LeftStickX).unwrap();
26 if left_stick_x.abs() > 0.01 {
27 info!("{} LeftStickX value is {}", entity, left_stick_x);
28 }
29 }
30}Sourcepub fn any_just_released(
&self,
button_inputs: impl IntoIterator<Item = GamepadButton>,
) -> bool
pub fn any_just_released( &self, button_inputs: impl IntoIterator<Item = GamepadButton>, ) -> bool
Returns true if any item in the GamepadButton iterator has just been released.
Sourcepub fn all_just_released(
&self,
button_inputs: impl IntoIterator<Item = GamepadButton>,
) -> bool
pub fn all_just_released( &self, button_inputs: impl IntoIterator<Item = GamepadButton>, ) -> bool
Returns true if all items in the GamepadButton iterator have just been released.
Sourcepub fn get_pressed(&self) -> impl Iterator<Item = &GamepadButton>
pub fn get_pressed(&self) -> impl Iterator<Item = &GamepadButton>
Returns an iterator over all digital buttons that are pressed.
Sourcepub fn get_just_pressed(&self) -> impl Iterator<Item = &GamepadButton>
pub fn get_just_pressed(&self) -> impl Iterator<Item = &GamepadButton>
Returns an iterator over all digital buttons that were just pressed.
Sourcepub fn get_just_released(&self) -> impl Iterator<Item = &GamepadButton>
pub fn get_just_released(&self) -> impl Iterator<Item = &GamepadButton>
Returns an iterator over all digital buttons that were just released.
Sourcepub fn get_analog_axes(&self) -> impl Iterator<Item = &GamepadInput>
pub fn get_analog_axes(&self) -> impl Iterator<Item = &GamepadInput>
Returns an iterator over all analog axes.
Sourcepub fn digital(&self) -> &ButtonInput<GamepadButton>
pub fn digital(&self) -> &ButtonInput<GamepadButton>
ButtonInput of GamepadButton representing their digital state.
Sourcepub fn digital_mut(&mut self) -> &mut ButtonInput<GamepadButton>
pub fn digital_mut(&mut self) -> &mut ButtonInput<GamepadButton>
Mutable ButtonInput of GamepadButton representing their digital state. Useful for mocking inputs.
Sourcepub fn analog(&self) -> &Axis<GamepadInput>
pub fn analog(&self) -> &Axis<GamepadInput>
Axis of GamepadButton representing their analog state.
Sourcepub fn analog_mut(&mut self) -> &mut Axis<GamepadInput>
pub fn analog_mut(&mut self) -> &mut Axis<GamepadInput>
Mutable Axis of GamepadButton representing their analog state. Useful for mocking inputs.
Trait Implementations§
Source§impl Component for Gamepad
Required Components: GamepadSettings.
impl Component for Gamepad
Required Components: GamepadSettings.
A component’s Required Components are inserted whenever it is inserted. Note that this will also insert the required components of the required components, recursively, in depth-first order.
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl FromReflect for Gamepad
impl FromReflect for Gamepad
Source§fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Gamepad>
fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Gamepad>
Self from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn PartialReflect>,
) -> Result<Self, Box<dyn PartialReflect>>
fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>
Self using,
constructing the value using from_reflect if that fails. Read moreSource§impl GetOwnership for Gamepad
impl GetOwnership for Gamepad
Source§impl GetTypeRegistration for Gamepad
impl GetTypeRegistration for Gamepad
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
TypeRegistration for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Source§impl IntoReturn for Gamepad
impl IntoReturn for Gamepad
Source§impl PartialReflect for Gamepad
impl PartialReflect for Gamepad
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn try_apply(
&mut self,
value: &(dyn PartialReflect + 'static),
) -> Result<(), ApplyError>
fn try_apply( &mut self, value: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Source§fn reflect_owned(self: Box<Gamepad>) -> ReflectOwned
fn reflect_owned(self: Box<Gamepad>) -> ReflectOwned
Source§fn try_into_reflect(
self: Box<Gamepad>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<Gamepad>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
Source§fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
Source§fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
Source§fn into_partial_reflect(self: Box<Gamepad>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<Gamepad>) -> Box<dyn PartialReflect>
Source§fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
Source§fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
Source§fn reflect_partial_eq(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<bool>
fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
Self using reflection. Read moreSource§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Source§fn to_dynamic(&self) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
Source§fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
PartialReflect, combines reflect_clone and
take in a useful fashion, automatically constructing an appropriate
ReflectCloneError if the downcast fails. Read moreSource§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Source§impl Reflect for Gamepad
impl Reflect for Gamepad
Source§fn into_any(self: Box<Gamepad>) -> Box<dyn Any>
fn into_any(self: Box<Gamepad>) -> Box<dyn Any>
Box<dyn Any>. Read moreSource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any. Read moreSource§fn into_reflect(self: Box<Gamepad>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Gamepad>) -> Box<dyn Reflect>
Source§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
Source§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
Source§impl Struct for Gamepad
impl Struct for Gamepad
Source§fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
name as a &dyn PartialReflect.Source§fn field_mut(
&mut self,
name: &str,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_mut( &mut self, name: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>
name as a
&mut dyn PartialReflect.Source§fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
index as a
&dyn PartialReflect.Source§fn field_at_mut(
&mut self,
index: usize,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_at_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>
index
as a &mut dyn PartialReflect.Source§fn name_at(&self, index: usize) -> Option<&str>
fn name_at(&self, index: usize) -> Option<&str>
index.Source§fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn iter_fields(&self) -> FieldIter<'_> ⓘ
Source§fn to_dynamic_struct(&self) -> DynamicStruct
fn to_dynamic_struct(&self) -> DynamicStruct
DynamicStruct from this struct.Source§fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
None if TypeInfo is not available.Source§impl TypePath for Gamepad
impl TypePath for Gamepad
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Auto Trait Implementations§
impl Freeze for Gamepad
impl RefUnwindSafe for Gamepad
impl Send for Gamepad
impl Sync for Gamepad
impl Unpin for Gamepad
impl UnwindSafe for Gamepad
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ids: &mut impl FnMut(ComponentId), )
Source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
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>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
Source§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<T> DynamicTyped for Twhere
T: Typed,
impl<T> DynamicTyped for Twhere
T: Typed,
Source§fn reflect_type_info(&self) -> &'static TypeInfo
fn reflect_type_info(&self) -> &'static TypeInfo
Typed::type_info.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
Source§impl<T> GetPath for T
impl<T> GetPath for T
Source§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
path. Read moreSource§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
path. Read moreSource§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.