pub enum NextState<S>where
S: FreelyMutableState,{
Unchanged,
Pending(S),
}
Expand description
The next state of State<S>
.
This can be fetched as a resource and used to queue state transitions.
To queue a transition, call NextState::set
or mutate the value to NextState::Pending
directly.
Note that these transitions can be overridden by other systems:
only the actual value of this resource during the StateTransition
schedule matters.
use bevy_state::prelude::*;
use bevy_ecs::prelude::*;
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Default, States)]
enum GameState {
#[default]
MainMenu,
SettingsMenu,
InGame,
}
fn start_game(mut next_game_state: ResMut<NextState<GameState>>) {
next_game_state.set(GameState::InGame);
}
Variants§
Implementations§
Source§impl<S> NextState<S>where
S: FreelyMutableState,
impl<S> NextState<S>where
S: FreelyMutableState,
Sourcepub fn set(&mut self, state: S)
pub fn set(&mut self, state: S)
Tentatively set a pending state transition to Some(state)
.
Examples found in repository?
More examples
examples/games/game_menu.rs (line 105)
99 fn countdown(
100 mut game_state: ResMut<NextState<GameState>>,
101 time: Res<Time>,
102 mut timer: ResMut<SplashTimer>,
103 ) {
104 if timer.tick(time.delta()).finished() {
105 game_state.set(GameState::Menu);
106 }
107 }
108}
109
110mod game {
111 use bevy::{
112 color::palettes::basic::{BLUE, LIME},
113 prelude::*,
114 };
115
116 use super::{despawn_screen, DisplayQuality, GameState, Volume, TEXT_COLOR};
117
118 // This plugin will contain the game. In this case, it's just be a screen that will
119 // display the current settings for 5 seconds before returning to the menu
120 pub fn game_plugin(app: &mut App) {
121 app.add_systems(OnEnter(GameState::Game), game_setup)
122 .add_systems(Update, game.run_if(in_state(GameState::Game)))
123 .add_systems(OnExit(GameState::Game), despawn_screen::<OnGameScreen>);
124 }
125
126 // Tag component used to tag entities added on the game screen
127 #[derive(Component)]
128 struct OnGameScreen;
129
130 #[derive(Resource, Deref, DerefMut)]
131 struct GameTimer(Timer);
132
133 fn game_setup(
134 mut commands: Commands,
135 display_quality: Res<DisplayQuality>,
136 volume: Res<Volume>,
137 ) {
138 commands.spawn((
139 Node {
140 width: Val::Percent(100.0),
141 height: Val::Percent(100.0),
142 // center children
143 align_items: AlignItems::Center,
144 justify_content: JustifyContent::Center,
145 ..default()
146 },
147 OnGameScreen,
148 children![(
149 Node {
150 // This will display its children in a column, from top to bottom
151 flex_direction: FlexDirection::Column,
152 // `align_items` will align children on the cross axis. Here the main axis is
153 // vertical (column), so the cross axis is horizontal. This will center the
154 // children
155 align_items: AlignItems::Center,
156 ..default()
157 },
158 BackgroundColor(Color::BLACK),
159 children![
160 (
161 Text::new("Will be back to the menu shortly..."),
162 TextFont {
163 font_size: 67.0,
164 ..default()
165 },
166 TextColor(TEXT_COLOR),
167 Node {
168 margin: UiRect::all(Val::Px(50.0)),
169 ..default()
170 },
171 ),
172 (
173 Text::default(),
174 Node {
175 margin: UiRect::all(Val::Px(50.0)),
176 ..default()
177 },
178 children![
179 (
180 TextSpan(format!("quality: {:?}", *display_quality)),
181 TextFont {
182 font_size: 50.0,
183 ..default()
184 },
185 TextColor(BLUE.into()),
186 ),
187 (
188 TextSpan::new(" - "),
189 TextFont {
190 font_size: 50.0,
191 ..default()
192 },
193 TextColor(TEXT_COLOR),
194 ),
195 (
196 TextSpan(format!("volume: {:?}", *volume)),
197 TextFont {
198 font_size: 50.0,
199 ..default()
200 },
201 TextColor(LIME.into()),
202 ),
203 ]
204 ),
205 ]
206 )],
207 ));
208 // Spawn a 5 seconds timer to trigger going back to the menu
209 commands.insert_resource(GameTimer(Timer::from_seconds(5.0, TimerMode::Once)));
210 }
211
212 // Tick the timer, and change state when finished
213 fn game(
214 time: Res<Time>,
215 mut game_state: ResMut<NextState<GameState>>,
216 mut timer: ResMut<GameTimer>,
217 ) {
218 if timer.tick(time.delta()).finished() {
219 game_state.set(GameState::Menu);
220 }
221 }
222}
223
224mod menu {
225 use bevy::{
226 app::AppExit,
227 color::palettes::css::CRIMSON,
228 ecs::spawn::{SpawnIter, SpawnWith},
229 prelude::*,
230 };
231
232 use super::{despawn_screen, DisplayQuality, GameState, Volume, TEXT_COLOR};
233
234 // This plugin manages the menu, with 5 different screens:
235 // - a main menu with "New Game", "Settings", "Quit"
236 // - a settings menu with two submenus and a back button
237 // - two settings screen with a setting that can be set and a back button
238 pub fn menu_plugin(app: &mut App) {
239 app
240 // At start, the menu is not enabled. This will be changed in `menu_setup` when
241 // entering the `GameState::Menu` state.
242 // Current screen in the menu is handled by an independent state from `GameState`
243 .init_state::<MenuState>()
244 .add_systems(OnEnter(GameState::Menu), menu_setup)
245 // Systems to handle the main menu screen
246 .add_systems(OnEnter(MenuState::Main), main_menu_setup)
247 .add_systems(OnExit(MenuState::Main), despawn_screen::<OnMainMenuScreen>)
248 // Systems to handle the settings menu screen
249 .add_systems(OnEnter(MenuState::Settings), settings_menu_setup)
250 .add_systems(
251 OnExit(MenuState::Settings),
252 despawn_screen::<OnSettingsMenuScreen>,
253 )
254 // Systems to handle the display settings screen
255 .add_systems(
256 OnEnter(MenuState::SettingsDisplay),
257 display_settings_menu_setup,
258 )
259 .add_systems(
260 Update,
261 (setting_button::<DisplayQuality>.run_if(in_state(MenuState::SettingsDisplay)),),
262 )
263 .add_systems(
264 OnExit(MenuState::SettingsDisplay),
265 despawn_screen::<OnDisplaySettingsMenuScreen>,
266 )
267 // Systems to handle the sound settings screen
268 .add_systems(OnEnter(MenuState::SettingsSound), sound_settings_menu_setup)
269 .add_systems(
270 Update,
271 setting_button::<Volume>.run_if(in_state(MenuState::SettingsSound)),
272 )
273 .add_systems(
274 OnExit(MenuState::SettingsSound),
275 despawn_screen::<OnSoundSettingsMenuScreen>,
276 )
277 // Common systems to all screens that handles buttons behavior
278 .add_systems(
279 Update,
280 (menu_action, button_system).run_if(in_state(GameState::Menu)),
281 );
282 }
283
284 // State used for the current menu screen
285 #[derive(Clone, Copy, Default, Eq, PartialEq, Debug, Hash, States)]
286 enum MenuState {
287 Main,
288 Settings,
289 SettingsDisplay,
290 SettingsSound,
291 #[default]
292 Disabled,
293 }
294
295 // Tag component used to tag entities added on the main menu screen
296 #[derive(Component)]
297 struct OnMainMenuScreen;
298
299 // Tag component used to tag entities added on the settings menu screen
300 #[derive(Component)]
301 struct OnSettingsMenuScreen;
302
303 // Tag component used to tag entities added on the display settings menu screen
304 #[derive(Component)]
305 struct OnDisplaySettingsMenuScreen;
306
307 // Tag component used to tag entities added on the sound settings menu screen
308 #[derive(Component)]
309 struct OnSoundSettingsMenuScreen;
310
311 const NORMAL_BUTTON: Color = Color::srgb(0.15, 0.15, 0.15);
312 const HOVERED_BUTTON: Color = Color::srgb(0.25, 0.25, 0.25);
313 const HOVERED_PRESSED_BUTTON: Color = Color::srgb(0.25, 0.65, 0.25);
314 const PRESSED_BUTTON: Color = Color::srgb(0.35, 0.75, 0.35);
315
316 // Tag component used to mark which setting is currently selected
317 #[derive(Component)]
318 struct SelectedOption;
319
320 // All actions that can be triggered from a button click
321 #[derive(Component)]
322 enum MenuButtonAction {
323 Play,
324 Settings,
325 SettingsDisplay,
326 SettingsSound,
327 BackToMainMenu,
328 BackToSettings,
329 Quit,
330 }
331
332 // This system handles changing all buttons color based on mouse interaction
333 fn button_system(
334 mut interaction_query: Query<
335 (&Interaction, &mut BackgroundColor, Option<&SelectedOption>),
336 (Changed<Interaction>, With<Button>),
337 >,
338 ) {
339 for (interaction, mut background_color, selected) in &mut interaction_query {
340 *background_color = match (*interaction, selected) {
341 (Interaction::Pressed, _) | (Interaction::None, Some(_)) => PRESSED_BUTTON.into(),
342 (Interaction::Hovered, Some(_)) => HOVERED_PRESSED_BUTTON.into(),
343 (Interaction::Hovered, None) => HOVERED_BUTTON.into(),
344 (Interaction::None, None) => NORMAL_BUTTON.into(),
345 }
346 }
347 }
348
349 // This system updates the settings when a new value for a setting is selected, and marks
350 // the button as the one currently selected
351 fn setting_button<T: Resource + Component + PartialEq + Copy>(
352 interaction_query: Query<(&Interaction, &T, Entity), (Changed<Interaction>, With<Button>)>,
353 selected_query: Single<(Entity, &mut BackgroundColor), With<SelectedOption>>,
354 mut commands: Commands,
355 mut setting: ResMut<T>,
356 ) {
357 let (previous_button, mut previous_button_color) = selected_query.into_inner();
358 for (interaction, button_setting, entity) in &interaction_query {
359 if *interaction == Interaction::Pressed && *setting != *button_setting {
360 *previous_button_color = NORMAL_BUTTON.into();
361 commands.entity(previous_button).remove::<SelectedOption>();
362 commands.entity(entity).insert(SelectedOption);
363 *setting = *button_setting;
364 }
365 }
366 }
367
368 fn menu_setup(mut menu_state: ResMut<NextState<MenuState>>) {
369 menu_state.set(MenuState::Main);
370 }
371
372 fn main_menu_setup(mut commands: Commands, asset_server: Res<AssetServer>) {
373 // Common style for all buttons on the screen
374 let button_node = Node {
375 width: Val::Px(300.0),
376 height: Val::Px(65.0),
377 margin: UiRect::all(Val::Px(20.0)),
378 justify_content: JustifyContent::Center,
379 align_items: AlignItems::Center,
380 ..default()
381 };
382 let button_icon_node = Node {
383 width: Val::Px(30.0),
384 // This takes the icons out of the flexbox flow, to be positioned exactly
385 position_type: PositionType::Absolute,
386 // The icon will be close to the left border of the button
387 left: Val::Px(10.0),
388 ..default()
389 };
390 let button_text_font = TextFont {
391 font_size: 33.0,
392 ..default()
393 };
394
395 let right_icon = asset_server.load("textures/Game Icons/right.png");
396 let wrench_icon = asset_server.load("textures/Game Icons/wrench.png");
397 let exit_icon = asset_server.load("textures/Game Icons/exitRight.png");
398
399 commands.spawn((
400 Node {
401 width: Val::Percent(100.0),
402 height: Val::Percent(100.0),
403 align_items: AlignItems::Center,
404 justify_content: JustifyContent::Center,
405 ..default()
406 },
407 OnMainMenuScreen,
408 children![(
409 Node {
410 flex_direction: FlexDirection::Column,
411 align_items: AlignItems::Center,
412 ..default()
413 },
414 BackgroundColor(CRIMSON.into()),
415 children![
416 // Display the game name
417 (
418 Text::new("Bevy Game Menu UI"),
419 TextFont {
420 font_size: 67.0,
421 ..default()
422 },
423 TextColor(TEXT_COLOR),
424 Node {
425 margin: UiRect::all(Val::Px(50.0)),
426 ..default()
427 },
428 ),
429 // Display three buttons for each action available from the main menu:
430 // - new game
431 // - settings
432 // - quit
433 (
434 Button,
435 button_node.clone(),
436 BackgroundColor(NORMAL_BUTTON),
437 MenuButtonAction::Play,
438 children![
439 (ImageNode::new(right_icon), button_icon_node.clone()),
440 (
441 Text::new("New Game"),
442 button_text_font.clone(),
443 TextColor(TEXT_COLOR),
444 ),
445 ]
446 ),
447 (
448 Button,
449 button_node.clone(),
450 BackgroundColor(NORMAL_BUTTON),
451 MenuButtonAction::Settings,
452 children![
453 (ImageNode::new(wrench_icon), button_icon_node.clone()),
454 (
455 Text::new("Settings"),
456 button_text_font.clone(),
457 TextColor(TEXT_COLOR),
458 ),
459 ]
460 ),
461 (
462 Button,
463 button_node,
464 BackgroundColor(NORMAL_BUTTON),
465 MenuButtonAction::Quit,
466 children![
467 (ImageNode::new(exit_icon), button_icon_node),
468 (Text::new("Quit"), button_text_font, TextColor(TEXT_COLOR),),
469 ]
470 ),
471 ]
472 )],
473 ));
474 }
475
476 fn settings_menu_setup(mut commands: Commands) {
477 let button_node = Node {
478 width: Val::Px(200.0),
479 height: Val::Px(65.0),
480 margin: UiRect::all(Val::Px(20.0)),
481 justify_content: JustifyContent::Center,
482 align_items: AlignItems::Center,
483 ..default()
484 };
485
486 let button_text_style = (
487 TextFont {
488 font_size: 33.0,
489 ..default()
490 },
491 TextColor(TEXT_COLOR),
492 );
493
494 commands.spawn((
495 Node {
496 width: Val::Percent(100.0),
497 height: Val::Percent(100.0),
498 align_items: AlignItems::Center,
499 justify_content: JustifyContent::Center,
500 ..default()
501 },
502 OnSettingsMenuScreen,
503 children![(
504 Node {
505 flex_direction: FlexDirection::Column,
506 align_items: AlignItems::Center,
507 ..default()
508 },
509 BackgroundColor(CRIMSON.into()),
510 Children::spawn(SpawnIter(
511 [
512 (MenuButtonAction::SettingsDisplay, "Display"),
513 (MenuButtonAction::SettingsSound, "Sound"),
514 (MenuButtonAction::BackToMainMenu, "Back"),
515 ]
516 .into_iter()
517 .map(move |(action, text)| {
518 (
519 Button,
520 button_node.clone(),
521 BackgroundColor(NORMAL_BUTTON),
522 action,
523 children![(Text::new(text), button_text_style.clone())],
524 )
525 })
526 ))
527 )],
528 ));
529 }
530
531 fn display_settings_menu_setup(mut commands: Commands, display_quality: Res<DisplayQuality>) {
532 fn button_node() -> Node {
533 Node {
534 width: Val::Px(200.0),
535 height: Val::Px(65.0),
536 margin: UiRect::all(Val::Px(20.0)),
537 justify_content: JustifyContent::Center,
538 align_items: AlignItems::Center,
539 ..default()
540 }
541 }
542 fn button_text_style() -> impl Bundle {
543 (
544 TextFont {
545 font_size: 33.0,
546 ..default()
547 },
548 TextColor(TEXT_COLOR),
549 )
550 }
551
552 let display_quality = *display_quality;
553 commands.spawn((
554 Node {
555 width: Val::Percent(100.0),
556 height: Val::Percent(100.0),
557 align_items: AlignItems::Center,
558 justify_content: JustifyContent::Center,
559 ..default()
560 },
561 OnDisplaySettingsMenuScreen,
562 children![(
563 Node {
564 flex_direction: FlexDirection::Column,
565 align_items: AlignItems::Center,
566 ..default()
567 },
568 BackgroundColor(CRIMSON.into()),
569 children![
570 // Create a new `Node`, this time not setting its `flex_direction`. It will
571 // use the default value, `FlexDirection::Row`, from left to right.
572 (
573 Node {
574 align_items: AlignItems::Center,
575 ..default()
576 },
577 BackgroundColor(CRIMSON.into()),
578 Children::spawn((
579 // Display a label for the current setting
580 Spawn((Text::new("Display Quality"), button_text_style())),
581 SpawnWith(move |parent: &mut ChildSpawner| {
582 for quality_setting in [
583 DisplayQuality::Low,
584 DisplayQuality::Medium,
585 DisplayQuality::High,
586 ] {
587 let mut entity = parent.spawn((
588 Button,
589 Node {
590 width: Val::Px(150.0),
591 height: Val::Px(65.0),
592 ..button_node()
593 },
594 BackgroundColor(NORMAL_BUTTON),
595 quality_setting,
596 children![(
597 Text::new(format!("{quality_setting:?}")),
598 button_text_style(),
599 )],
600 ));
601 if display_quality == quality_setting {
602 entity.insert(SelectedOption);
603 }
604 }
605 })
606 ))
607 ),
608 // Display the back button to return to the settings screen
609 (
610 Button,
611 button_node(),
612 BackgroundColor(NORMAL_BUTTON),
613 MenuButtonAction::BackToSettings,
614 children![(Text::new("Back"), button_text_style())]
615 )
616 ]
617 )],
618 ));
619 }
620
621 fn sound_settings_menu_setup(mut commands: Commands, volume: Res<Volume>) {
622 let button_node = Node {
623 width: Val::Px(200.0),
624 height: Val::Px(65.0),
625 margin: UiRect::all(Val::Px(20.0)),
626 justify_content: JustifyContent::Center,
627 align_items: AlignItems::Center,
628 ..default()
629 };
630 let button_text_style = (
631 TextFont {
632 font_size: 33.0,
633 ..default()
634 },
635 TextColor(TEXT_COLOR),
636 );
637
638 let volume = *volume;
639 let button_node_clone = button_node.clone();
640 commands.spawn((
641 Node {
642 width: Val::Percent(100.0),
643 height: Val::Percent(100.0),
644 align_items: AlignItems::Center,
645 justify_content: JustifyContent::Center,
646 ..default()
647 },
648 OnSoundSettingsMenuScreen,
649 children![(
650 Node {
651 flex_direction: FlexDirection::Column,
652 align_items: AlignItems::Center,
653 ..default()
654 },
655 BackgroundColor(CRIMSON.into()),
656 children![
657 (
658 Node {
659 align_items: AlignItems::Center,
660 ..default()
661 },
662 BackgroundColor(CRIMSON.into()),
663 Children::spawn((
664 Spawn((Text::new("Volume"), button_text_style.clone())),
665 SpawnWith(move |parent: &mut ChildSpawner| {
666 for volume_setting in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] {
667 let mut entity = parent.spawn((
668 Button,
669 Node {
670 width: Val::Px(30.0),
671 height: Val::Px(65.0),
672 ..button_node_clone.clone()
673 },
674 BackgroundColor(NORMAL_BUTTON),
675 Volume(volume_setting),
676 ));
677 if volume == Volume(volume_setting) {
678 entity.insert(SelectedOption);
679 }
680 }
681 })
682 ))
683 ),
684 (
685 Button,
686 button_node,
687 BackgroundColor(NORMAL_BUTTON),
688 MenuButtonAction::BackToSettings,
689 children![(Text::new("Back"), button_text_style)]
690 )
691 ]
692 )],
693 ));
694 }
695
696 fn menu_action(
697 interaction_query: Query<
698 (&Interaction, &MenuButtonAction),
699 (Changed<Interaction>, With<Button>),
700 >,
701 mut app_exit_events: EventWriter<AppExit>,
702 mut menu_state: ResMut<NextState<MenuState>>,
703 mut game_state: ResMut<NextState<GameState>>,
704 ) {
705 for (interaction, menu_button_action) in &interaction_query {
706 if *interaction == Interaction::Pressed {
707 match menu_button_action {
708 MenuButtonAction::Quit => {
709 app_exit_events.write(AppExit::Success);
710 }
711 MenuButtonAction::Play => {
712 game_state.set(GameState::Game);
713 menu_state.set(MenuState::Disabled);
714 }
715 MenuButtonAction::Settings => menu_state.set(MenuState::Settings),
716 MenuButtonAction::SettingsDisplay => {
717 menu_state.set(MenuState::SettingsDisplay);
718 }
719 MenuButtonAction::SettingsSound => {
720 menu_state.set(MenuState::SettingsSound);
721 }
722 MenuButtonAction::BackToMainMenu => menu_state.set(MenuState::Main),
723 MenuButtonAction::BackToSettings => {
724 menu_state.set(MenuState::Settings);
725 }
726 }
727 }
728 }
729 }
examples/math/render_primitives.rs (line 363)
358fn switch_cameras(current: Res<State<CameraActive>>, mut next: ResMut<NextState<CameraActive>>) {
359 let next_state = match current.get() {
360 CameraActive::Dim2 => CameraActive::Dim3,
361 CameraActive::Dim3 => CameraActive::Dim2,
362 };
363 next.set(next_state);
364}
365
366fn setup_text(mut commands: Commands, cameras: Query<(Entity, &Camera)>) {
367 let active_camera = cameras
368 .iter()
369 .find_map(|(entity, camera)| camera.is_active.then_some(entity))
370 .expect("run condition ensures existence");
371 commands.spawn((
372 HeaderNode,
373 Node {
374 justify_self: JustifySelf::Center,
375 top: Val::Px(5.0),
376 ..Default::default()
377 },
378 UiTargetCamera(active_camera),
379 children![(
380 Text::default(),
381 HeaderText,
382 TextLayout::new_with_justify(JustifyText::Center),
383 children![
384 TextSpan::new("Primitive: "),
385 TextSpan(format!("{text}", text = PrimitiveSelected::default())),
386 TextSpan::new("\n\n"),
387 TextSpan::new(
388 "Press 'C' to switch between 2D and 3D mode\n\
389 Press 'Up' or 'Down' to switch to the next/previous primitive",
390 ),
391 TextSpan::new("\n\n"),
392 TextSpan::new("(If nothing is displayed, there's no rendering support yet)",),
393 ]
394 )],
395 ));
396}
397
398fn update_text(
399 primitive_state: Res<State<PrimitiveSelected>>,
400 header: Query<Entity, With<HeaderText>>,
401 mut writer: TextUiWriter,
402) {
403 let new_text = format!("{text}", text = primitive_state.get());
404 header.iter().for_each(|header_text| {
405 if let Some(mut text) = writer.get_text(header_text, 2) {
406 (*text).clone_from(&new_text);
407 };
408 });
409}
410
411fn switch_to_next_primitive(
412 current: Res<State<PrimitiveSelected>>,
413 mut next: ResMut<NextState<PrimitiveSelected>>,
414) {
415 let next_state = current.get().next();
416 next.set(next_state);
417}
418
419fn switch_to_previous_primitive(
420 current: Res<State<PrimitiveSelected>>,
421 mut next: ResMut<NextState<PrimitiveSelected>>,
422) {
423 let next_state = current.get().previous();
424 next.set(next_state);
425}
Additional examples can be found in:
- examples/math/custom_primitives.rs
- examples/2d/texture_atlas.rs
- examples/math/bounding_2d.rs
- examples/asset/multi_asset_sync.rs
- examples/state/custom_transitions.rs
- examples/state/states.rs
- examples/state/sub_states.rs
- examples/testbed/helpers.rs
- examples/games/alien_cake_addict.rs
- examples/state/computed_states.rs
Trait Implementations§
Source§impl<S> Default for NextState<S>where
S: FreelyMutableState,
impl<S> Default for NextState<S>where
S: FreelyMutableState,
Source§impl<S> Enum for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> Enum for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§fn field(&self, __name_param: &str) -> Option<&(dyn PartialReflect + 'static)>
fn field(&self, __name_param: &str) -> Option<&(dyn PartialReflect + 'static)>
Returns a reference to the value of the field (in the current variant) with the given name. Read more
Source§fn field_at(
&self,
__index_param: usize,
) -> Option<&(dyn PartialReflect + 'static)>
fn field_at( &self, __index_param: usize, ) -> Option<&(dyn PartialReflect + 'static)>
Returns a reference to the value of the field (in the current variant) at the given index.
Source§fn field_mut(
&mut self,
__name_param: &str,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_mut( &mut self, __name_param: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>
Returns a mutable reference to the value of the field (in the current variant) with the given name. Read more
Source§fn field_at_mut(
&mut self,
__index_param: usize,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_at_mut( &mut self, __index_param: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>
Returns a mutable reference to the value of the field (in the current variant) at the given index.
Source§fn index_of(&self, __name_param: &str) -> Option<usize>
fn index_of(&self, __name_param: &str) -> Option<usize>
Returns the index of the field (in the current variant) with the given name. Read more
Source§fn name_at(&self, __index_param: usize) -> Option<&str>
fn name_at(&self, __index_param: usize) -> Option<&str>
Returns the name of the field (in the current variant) with the given index. Read more
Source§fn iter_fields(&self) -> VariantFieldIter<'_> ⓘ
fn iter_fields(&self) -> VariantFieldIter<'_> ⓘ
Returns an iterator over the values of the current variant’s fields.
Source§fn variant_name(&self) -> &str
fn variant_name(&self) -> &str
The name of the current variant.
Source§fn variant_index(&self) -> usize
fn variant_index(&self) -> usize
The index of the current variant.
Source§fn variant_type(&self) -> VariantType
fn variant_type(&self) -> VariantType
The type of the current variant.
Source§fn to_dynamic_enum(&self) -> DynamicEnum
fn to_dynamic_enum(&self) -> DynamicEnum
Creates a new
DynamicEnum
from this enum.Source§fn clone_dynamic(&self) -> DynamicEnum
fn clone_dynamic(&self) -> DynamicEnum
👎Deprecated since 0.16.0: use
to_dynamic_enum
insteadSource§fn is_variant(&self, variant_type: VariantType) -> bool
fn is_variant(&self, variant_type: VariantType) -> bool
Returns true if the current variant’s type matches the given one.
Source§fn variant_path(&self) -> String
fn variant_path(&self) -> String
Returns the full path to the current variant.
Source§impl<S> FromArg for &'static NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> FromArg for &'static NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§impl<S> FromArg for &'static mut NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> FromArg for &'static mut NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§impl<S> FromArg for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> FromArg for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§impl<S> FromReflect for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> FromReflect for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§fn from_reflect(
__param0: &(dyn PartialReflect + 'static),
) -> Option<NextState<S>>
fn from_reflect( __param0: &(dyn PartialReflect + 'static), ) -> Option<NextState<S>>
Constructs a concrete instance of
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>>
Attempts to downcast the given value to
Self
using,
constructing the value using from_reflect
if that fails. Read moreSource§impl<S> GetOwnership for &NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> GetOwnership for &NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§impl<S> GetOwnership for &mut NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> GetOwnership for &mut NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§impl<S> GetOwnership for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> GetOwnership for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§impl<S> GetTypeRegistration for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> GetTypeRegistration for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
Returns the default
TypeRegistration
for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Registers other types needed by this type. Read more
Source§impl<S> IntoReturn for &NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> IntoReturn for &NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§impl<S> IntoReturn for &mut NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> IntoReturn for &mut NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§impl<S> IntoReturn for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> IntoReturn for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§impl<S> PartialReflect for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> PartialReflect for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
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_param: &(dyn PartialReflect + 'static),
) -> Result<(), ApplyError>
fn try_apply( &mut self, __value_param: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Returns a zero-sized enumeration of “kinds” of type. Read more
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Returns an immutable enumeration of “kinds” of type. Read more
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Returns a mutable enumeration of “kinds” of type. Read more
Source§fn reflect_owned(self: Box<NextState<S>>) -> ReflectOwned
fn reflect_owned(self: Box<NextState<S>>) -> ReflectOwned
Returns an owned enumeration of “kinds” of type. Read more
Source§fn try_into_reflect(
self: Box<NextState<S>>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<NextState<S>>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
Attempts to cast this type to a boxed, fully-reflected value.
Source§fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
Attempts to cast this type to a fully-reflected value.
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)>
Attempts to cast this type to a mutable, fully-reflected value.
Source§fn into_partial_reflect(self: Box<NextState<S>>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<NextState<S>>) -> Box<dyn PartialReflect>
Casts this type to a boxed, reflected value. Read more
Source§fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
Casts this type to a reflected value. Read more
Source§fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
Casts this type to a mutable, reflected value. Read more
Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Returns a hash of the value (which includes the type). Read more
Source§fn reflect_partial_eq(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<bool>
fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>
Returns a “partial equality” comparison result. Read more
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Debug formatter for the value. Read more
Source§fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
Attempts to clone
Self
using reflection. Read moreSource§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Applies a reflected value to this value. Read more
Source§fn clone_value(&self) -> Box<dyn PartialReflect>
fn clone_value(&self) -> Box<dyn PartialReflect>
👎Deprecated since 0.16.0: to clone reflected values, prefer using
reflect_clone
. To convert reflected values to dynamic ones, use to_dynamic
.Clones
Self
into its dynamic representation. Read moreSource§fn to_dynamic(&self) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Indicates whether or not this type is a dynamic type. Read more
Source§impl<S> Reflect for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> Reflect for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
Source§fn into_any(self: Box<NextState<S>>) -> Box<dyn Any>
fn into_any(self: Box<NextState<S>>) -> Box<dyn Any>
Returns the value as a
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)
Returns the value as a
&mut dyn Any
. Read moreSource§fn into_reflect(self: Box<NextState<S>>) -> Box<dyn Reflect>
fn into_reflect(self: Box<NextState<S>>) -> Box<dyn Reflect>
Casts this type to a boxed, fully-reflected value.
Source§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
Casts this type to a fully-reflected value.
Source§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
Casts this type to a mutable, fully-reflected value.
Source§impl<S> TypePath for NextState<S>
impl<S> TypePath for NextState<S>
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Returns the fully qualified path of the underlying type. Read more
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Returns a short, pretty-print enabled path to the type. Read more
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>
Source§impl<S> Typed for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> Typed for NextState<S>where
S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection,
NextState<S>: Any + Send + Sync,
impl<S> Resource for NextState<S>
Auto Trait Implementations§
impl<S> Freeze for NextState<S>where
S: Freeze,
impl<S> RefUnwindSafe for NextState<S>where
S: RefUnwindSafe,
impl<S> Send for NextState<S>
impl<S> Sync for NextState<S>
impl<S> Unpin for NextState<S>where
S: Unpin,
impl<S> UnwindSafe for NextState<S>where
S: UnwindSafe,
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
Return the
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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)
Converts
&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)
Converts
&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>
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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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
See
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>
See
TypePath::type_ident
.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
See
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
See
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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<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>>
Returns a reference to the value specified by
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>>
Returns a mutable reference to the value specified by
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,
Returns a statically typed reference to the value specified by
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,
Returns a statically typed mutable reference to the value specified by
path
. Read moreSource§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> ⓘ
Converts
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> ⓘ
Converts
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<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,
Pipes by value. This is generally the method you want to use. Read more
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,
Borrows
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,
Mutably borrows
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
Borrows
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
Mutably borrows
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
Borrows
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>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.