NextState

Enum NextState 

Source
pub enum NextState<S>{
    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§

§

Unchanged

No state transition is pending

§

Pending(S)

There is a pending transition for state S

Implementations§

Source§

impl<S> NextState<S>

Source

pub fn set(&mut self, state: S)

Tentatively set a pending state transition to Some(state).

Examples found in repository?
examples/ecs/generic_system.rs (line 79)
74fn transition_to_in_game_system(
75    mut next_state: ResMut<NextState<AppState>>,
76    keyboard_input: Res<ButtonInput<KeyCode>>,
77) {
78    if keyboard_input.pressed(KeyCode::Space) {
79        next_state.set(AppState::InGame);
80    }
81}
More examples
Hide additional examples
examples/games/game_menu.rs (line 104)
98    fn countdown(
99        mut game_state: ResMut<NextState<GameState>>,
100        time: Res<Time>,
101        mut timer: ResMut<SplashTimer>,
102    ) {
103        if timer.tick(time.delta()).is_finished() {
104            game_state.set(GameState::Menu);
105        }
106    }
107}
108
109mod game {
110    use bevy::{
111        color::palettes::basic::{BLUE, LIME},
112        prelude::*,
113    };
114
115    use super::{DisplayQuality, GameState, Volume, TEXT_COLOR};
116
117    // This plugin will contain the game. In this case, it's just be a screen that will
118    // display the current settings for 5 seconds before returning to the menu
119    pub fn game_plugin(app: &mut App) {
120        app.add_systems(OnEnter(GameState::Game), game_setup)
121            .add_systems(Update, game.run_if(in_state(GameState::Game)));
122    }
123
124    // Tag component used to tag entities added on the game screen
125    #[derive(Component)]
126    struct OnGameScreen;
127
128    #[derive(Resource, Deref, DerefMut)]
129    struct GameTimer(Timer);
130
131    fn game_setup(
132        mut commands: Commands,
133        display_quality: Res<DisplayQuality>,
134        volume: Res<Volume>,
135    ) {
136        commands.spawn((
137            DespawnOnExit(GameState::Game),
138            Node {
139                width: percent(100),
140                height: percent(100),
141                // center children
142                align_items: AlignItems::Center,
143                justify_content: JustifyContent::Center,
144                ..default()
145            },
146            OnGameScreen,
147            children![(
148                Node {
149                    // This will display its children in a column, from top to bottom
150                    flex_direction: FlexDirection::Column,
151                    // `align_items` will align children on the cross axis. Here the main axis is
152                    // vertical (column), so the cross axis is horizontal. This will center the
153                    // children
154                    align_items: AlignItems::Center,
155                    ..default()
156                },
157                BackgroundColor(Color::BLACK),
158                children![
159                    (
160                        Text::new("Will be back to the menu shortly..."),
161                        TextFont {
162                            font_size: 67.0,
163                            ..default()
164                        },
165                        TextColor(TEXT_COLOR),
166                        Node {
167                            margin: UiRect::all(px(50)),
168                            ..default()
169                        },
170                    ),
171                    (
172                        Text::default(),
173                        Node {
174                            margin: UiRect::all(px(50)),
175                            ..default()
176                        },
177                        children![
178                            (
179                                TextSpan(format!("quality: {:?}", *display_quality)),
180                                TextFont {
181                                    font_size: 50.0,
182                                    ..default()
183                                },
184                                TextColor(BLUE.into()),
185                            ),
186                            (
187                                TextSpan::new(" - "),
188                                TextFont {
189                                    font_size: 50.0,
190                                    ..default()
191                                },
192                                TextColor(TEXT_COLOR),
193                            ),
194                            (
195                                TextSpan(format!("volume: {:?}", *volume)),
196                                TextFont {
197                                    font_size: 50.0,
198                                    ..default()
199                                },
200                                TextColor(LIME.into()),
201                            ),
202                        ]
203                    ),
204                ]
205            )],
206        ));
207        // Spawn a 5 seconds timer to trigger going back to the menu
208        commands.insert_resource(GameTimer(Timer::from_seconds(5.0, TimerMode::Once)));
209    }
210
211    // Tick the timer, and change state when finished
212    fn game(
213        time: Res<Time>,
214        mut game_state: ResMut<NextState<GameState>>,
215        mut timer: ResMut<GameTimer>,
216    ) {
217        if timer.tick(time.delta()).is_finished() {
218            game_state.set(GameState::Menu);
219        }
220    }
221}
222
223mod menu {
224    use bevy::{
225        app::AppExit,
226        color::palettes::css::CRIMSON,
227        ecs::spawn::{SpawnIter, SpawnWith},
228        prelude::*,
229    };
230
231    use super::{DisplayQuality, GameState, Volume, TEXT_COLOR};
232
233    // This plugin manages the menu, with 5 different screens:
234    // - a main menu with "New Game", "Settings", "Quit"
235    // - a settings menu with two submenus and a back button
236    // - two settings screen with a setting that can be set and a back button
237    pub fn menu_plugin(app: &mut App) {
238        app
239            // At start, the menu is not enabled. This will be changed in `menu_setup` when
240            // entering the `GameState::Menu` state.
241            // Current screen in the menu is handled by an independent state from `GameState`
242            .init_state::<MenuState>()
243            .add_systems(OnEnter(GameState::Menu), menu_setup)
244            // Systems to handle the main menu screen
245            .add_systems(OnEnter(MenuState::Main), main_menu_setup)
246            // Systems to handle the settings menu screen
247            .add_systems(OnEnter(MenuState::Settings), settings_menu_setup)
248            // Systems to handle the display settings screen
249            .add_systems(
250                OnEnter(MenuState::SettingsDisplay),
251                display_settings_menu_setup,
252            )
253            .add_systems(
254                Update,
255                (setting_button::<DisplayQuality>.run_if(in_state(MenuState::SettingsDisplay)),),
256            )
257            // Systems to handle the sound settings screen
258            .add_systems(OnEnter(MenuState::SettingsSound), sound_settings_menu_setup)
259            .add_systems(
260                Update,
261                setting_button::<Volume>.run_if(in_state(MenuState::SettingsSound)),
262            )
263            // Common systems to all screens that handles buttons behavior
264            .add_systems(
265                Update,
266                (menu_action, button_system).run_if(in_state(GameState::Menu)),
267            );
268    }
269
270    // State used for the current menu screen
271    #[derive(Clone, Copy, Default, Eq, PartialEq, Debug, Hash, States)]
272    enum MenuState {
273        Main,
274        Settings,
275        SettingsDisplay,
276        SettingsSound,
277        #[default]
278        Disabled,
279    }
280
281    // Tag component used to tag entities added on the main menu screen
282    #[derive(Component)]
283    struct OnMainMenuScreen;
284
285    // Tag component used to tag entities added on the settings menu screen
286    #[derive(Component)]
287    struct OnSettingsMenuScreen;
288
289    // Tag component used to tag entities added on the display settings menu screen
290    #[derive(Component)]
291    struct OnDisplaySettingsMenuScreen;
292
293    // Tag component used to tag entities added on the sound settings menu screen
294    #[derive(Component)]
295    struct OnSoundSettingsMenuScreen;
296
297    const NORMAL_BUTTON: Color = Color::srgb(0.15, 0.15, 0.15);
298    const HOVERED_BUTTON: Color = Color::srgb(0.25, 0.25, 0.25);
299    const HOVERED_PRESSED_BUTTON: Color = Color::srgb(0.25, 0.65, 0.25);
300    const PRESSED_BUTTON: Color = Color::srgb(0.35, 0.75, 0.35);
301
302    // Tag component used to mark which setting is currently selected
303    #[derive(Component)]
304    struct SelectedOption;
305
306    // All actions that can be triggered from a button click
307    #[derive(Component)]
308    enum MenuButtonAction {
309        Play,
310        Settings,
311        SettingsDisplay,
312        SettingsSound,
313        BackToMainMenu,
314        BackToSettings,
315        Quit,
316    }
317
318    // This system handles changing all buttons color based on mouse interaction
319    fn button_system(
320        mut interaction_query: Query<
321            (&Interaction, &mut BackgroundColor, Option<&SelectedOption>),
322            (Changed<Interaction>, With<Button>),
323        >,
324    ) {
325        for (interaction, mut background_color, selected) in &mut interaction_query {
326            *background_color = match (*interaction, selected) {
327                (Interaction::Pressed, _) | (Interaction::None, Some(_)) => PRESSED_BUTTON.into(),
328                (Interaction::Hovered, Some(_)) => HOVERED_PRESSED_BUTTON.into(),
329                (Interaction::Hovered, None) => HOVERED_BUTTON.into(),
330                (Interaction::None, None) => NORMAL_BUTTON.into(),
331            }
332        }
333    }
334
335    // This system updates the settings when a new value for a setting is selected, and marks
336    // the button as the one currently selected
337    fn setting_button<T: Resource + Component + PartialEq + Copy>(
338        interaction_query: Query<(&Interaction, &T, Entity), (Changed<Interaction>, With<Button>)>,
339        selected_query: Single<(Entity, &mut BackgroundColor), With<SelectedOption>>,
340        mut commands: Commands,
341        mut setting: ResMut<T>,
342    ) {
343        let (previous_button, mut previous_button_color) = selected_query.into_inner();
344        for (interaction, button_setting, entity) in &interaction_query {
345            if *interaction == Interaction::Pressed && *setting != *button_setting {
346                *previous_button_color = NORMAL_BUTTON.into();
347                commands.entity(previous_button).remove::<SelectedOption>();
348                commands.entity(entity).insert(SelectedOption);
349                *setting = *button_setting;
350            }
351        }
352    }
353
354    fn menu_setup(mut menu_state: ResMut<NextState<MenuState>>) {
355        menu_state.set(MenuState::Main);
356    }
357
358    fn main_menu_setup(mut commands: Commands, asset_server: Res<AssetServer>) {
359        // Common style for all buttons on the screen
360        let button_node = Node {
361            width: px(300),
362            height: px(65),
363            margin: UiRect::all(px(20)),
364            justify_content: JustifyContent::Center,
365            align_items: AlignItems::Center,
366            ..default()
367        };
368        let button_icon_node = Node {
369            width: px(30),
370            // This takes the icons out of the flexbox flow, to be positioned exactly
371            position_type: PositionType::Absolute,
372            // The icon will be close to the left border of the button
373            left: px(10),
374            ..default()
375        };
376        let button_text_font = TextFont {
377            font_size: 33.0,
378            ..default()
379        };
380
381        let right_icon = asset_server.load("textures/Game Icons/right.png");
382        let wrench_icon = asset_server.load("textures/Game Icons/wrench.png");
383        let exit_icon = asset_server.load("textures/Game Icons/exitRight.png");
384
385        commands.spawn((
386            DespawnOnExit(MenuState::Main),
387            Node {
388                width: percent(100),
389                height: percent(100),
390                align_items: AlignItems::Center,
391                justify_content: JustifyContent::Center,
392                ..default()
393            },
394            OnMainMenuScreen,
395            children![(
396                Node {
397                    flex_direction: FlexDirection::Column,
398                    align_items: AlignItems::Center,
399                    ..default()
400                },
401                BackgroundColor(CRIMSON.into()),
402                children![
403                    // Display the game name
404                    (
405                        Text::new("Bevy Game Menu UI"),
406                        TextFont {
407                            font_size: 67.0,
408                            ..default()
409                        },
410                        TextColor(TEXT_COLOR),
411                        Node {
412                            margin: UiRect::all(px(50)),
413                            ..default()
414                        },
415                    ),
416                    // Display three buttons for each action available from the main menu:
417                    // - new game
418                    // - settings
419                    // - quit
420                    (
421                        Button,
422                        button_node.clone(),
423                        BackgroundColor(NORMAL_BUTTON),
424                        MenuButtonAction::Play,
425                        children![
426                            (ImageNode::new(right_icon), button_icon_node.clone()),
427                            (
428                                Text::new("New Game"),
429                                button_text_font.clone(),
430                                TextColor(TEXT_COLOR),
431                            ),
432                        ]
433                    ),
434                    (
435                        Button,
436                        button_node.clone(),
437                        BackgroundColor(NORMAL_BUTTON),
438                        MenuButtonAction::Settings,
439                        children![
440                            (ImageNode::new(wrench_icon), button_icon_node.clone()),
441                            (
442                                Text::new("Settings"),
443                                button_text_font.clone(),
444                                TextColor(TEXT_COLOR),
445                            ),
446                        ]
447                    ),
448                    (
449                        Button,
450                        button_node,
451                        BackgroundColor(NORMAL_BUTTON),
452                        MenuButtonAction::Quit,
453                        children![
454                            (ImageNode::new(exit_icon), button_icon_node),
455                            (Text::new("Quit"), button_text_font, TextColor(TEXT_COLOR),),
456                        ]
457                    ),
458                ]
459            )],
460        ));
461    }
462
463    fn settings_menu_setup(mut commands: Commands) {
464        let button_node = Node {
465            width: px(200),
466            height: px(65),
467            margin: UiRect::all(px(20)),
468            justify_content: JustifyContent::Center,
469            align_items: AlignItems::Center,
470            ..default()
471        };
472
473        let button_text_style = (
474            TextFont {
475                font_size: 33.0,
476                ..default()
477            },
478            TextColor(TEXT_COLOR),
479        );
480
481        commands.spawn((
482            DespawnOnExit(MenuState::Settings),
483            Node {
484                width: percent(100),
485                height: percent(100),
486                align_items: AlignItems::Center,
487                justify_content: JustifyContent::Center,
488                ..default()
489            },
490            OnSettingsMenuScreen,
491            children![(
492                Node {
493                    flex_direction: FlexDirection::Column,
494                    align_items: AlignItems::Center,
495                    ..default()
496                },
497                BackgroundColor(CRIMSON.into()),
498                Children::spawn(SpawnIter(
499                    [
500                        (MenuButtonAction::SettingsDisplay, "Display"),
501                        (MenuButtonAction::SettingsSound, "Sound"),
502                        (MenuButtonAction::BackToMainMenu, "Back"),
503                    ]
504                    .into_iter()
505                    .map(move |(action, text)| {
506                        (
507                            Button,
508                            button_node.clone(),
509                            BackgroundColor(NORMAL_BUTTON),
510                            action,
511                            children![(Text::new(text), button_text_style.clone())],
512                        )
513                    })
514                ))
515            )],
516        ));
517    }
518
519    fn display_settings_menu_setup(mut commands: Commands, display_quality: Res<DisplayQuality>) {
520        fn button_node() -> Node {
521            Node {
522                width: px(200),
523                height: px(65),
524                margin: UiRect::all(px(20)),
525                justify_content: JustifyContent::Center,
526                align_items: AlignItems::Center,
527                ..default()
528            }
529        }
530        fn button_text_style() -> impl Bundle {
531            (
532                TextFont {
533                    font_size: 33.0,
534                    ..default()
535                },
536                TextColor(TEXT_COLOR),
537            )
538        }
539
540        let display_quality = *display_quality;
541        commands.spawn((
542            DespawnOnExit(MenuState::SettingsDisplay),
543            Node {
544                width: percent(100),
545                height: percent(100),
546                align_items: AlignItems::Center,
547                justify_content: JustifyContent::Center,
548                ..default()
549            },
550            OnDisplaySettingsMenuScreen,
551            children![(
552                Node {
553                    flex_direction: FlexDirection::Column,
554                    align_items: AlignItems::Center,
555                    ..default()
556                },
557                BackgroundColor(CRIMSON.into()),
558                children![
559                    // Create a new `Node`, this time not setting its `flex_direction`. It will
560                    // use the default value, `FlexDirection::Row`, from left to right.
561                    (
562                        Node {
563                            align_items: AlignItems::Center,
564                            ..default()
565                        },
566                        BackgroundColor(CRIMSON.into()),
567                        Children::spawn((
568                            // Display a label for the current setting
569                            Spawn((Text::new("Display Quality"), button_text_style())),
570                            SpawnWith(move |parent: &mut ChildSpawner| {
571                                for quality_setting in [
572                                    DisplayQuality::Low,
573                                    DisplayQuality::Medium,
574                                    DisplayQuality::High,
575                                ] {
576                                    let mut entity = parent.spawn((
577                                        Button,
578                                        Node {
579                                            width: px(150),
580                                            height: px(65),
581                                            ..button_node()
582                                        },
583                                        BackgroundColor(NORMAL_BUTTON),
584                                        quality_setting,
585                                        children![(
586                                            Text::new(format!("{quality_setting:?}")),
587                                            button_text_style(),
588                                        )],
589                                    ));
590                                    if display_quality == quality_setting {
591                                        entity.insert(SelectedOption);
592                                    }
593                                }
594                            })
595                        ))
596                    ),
597                    // Display the back button to return to the settings screen
598                    (
599                        Button,
600                        button_node(),
601                        BackgroundColor(NORMAL_BUTTON),
602                        MenuButtonAction::BackToSettings,
603                        children![(Text::new("Back"), button_text_style())]
604                    )
605                ]
606            )],
607        ));
608    }
609
610    fn sound_settings_menu_setup(mut commands: Commands, volume: Res<Volume>) {
611        let button_node = Node {
612            width: px(200),
613            height: px(65),
614            margin: UiRect::all(px(20)),
615            justify_content: JustifyContent::Center,
616            align_items: AlignItems::Center,
617            ..default()
618        };
619        let button_text_style = (
620            TextFont {
621                font_size: 33.0,
622                ..default()
623            },
624            TextColor(TEXT_COLOR),
625        );
626
627        let volume = *volume;
628        let button_node_clone = button_node.clone();
629        commands.spawn((
630            DespawnOnExit(MenuState::SettingsSound),
631            Node {
632                width: percent(100),
633                height: percent(100),
634                align_items: AlignItems::Center,
635                justify_content: JustifyContent::Center,
636                ..default()
637            },
638            OnSoundSettingsMenuScreen,
639            children![(
640                Node {
641                    flex_direction: FlexDirection::Column,
642                    align_items: AlignItems::Center,
643                    ..default()
644                },
645                BackgroundColor(CRIMSON.into()),
646                children![
647                    (
648                        Node {
649                            align_items: AlignItems::Center,
650                            ..default()
651                        },
652                        BackgroundColor(CRIMSON.into()),
653                        Children::spawn((
654                            Spawn((Text::new("Volume"), button_text_style.clone())),
655                            SpawnWith(move |parent: &mut ChildSpawner| {
656                                for volume_setting in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] {
657                                    let mut entity = parent.spawn((
658                                        Button,
659                                        Node {
660                                            width: px(30),
661                                            height: px(65),
662                                            ..button_node_clone.clone()
663                                        },
664                                        BackgroundColor(NORMAL_BUTTON),
665                                        Volume(volume_setting),
666                                    ));
667                                    if volume == Volume(volume_setting) {
668                                        entity.insert(SelectedOption);
669                                    }
670                                }
671                            })
672                        ))
673                    ),
674                    (
675                        Button,
676                        button_node,
677                        BackgroundColor(NORMAL_BUTTON),
678                        MenuButtonAction::BackToSettings,
679                        children![(Text::new("Back"), button_text_style)]
680                    )
681                ]
682            )],
683        ));
684    }
685
686    fn menu_action(
687        interaction_query: Query<
688            (&Interaction, &MenuButtonAction),
689            (Changed<Interaction>, With<Button>),
690        >,
691        mut app_exit_writer: MessageWriter<AppExit>,
692        mut menu_state: ResMut<NextState<MenuState>>,
693        mut game_state: ResMut<NextState<GameState>>,
694    ) {
695        for (interaction, menu_button_action) in &interaction_query {
696            if *interaction == Interaction::Pressed {
697                match menu_button_action {
698                    MenuButtonAction::Quit => {
699                        app_exit_writer.write(AppExit::Success);
700                    }
701                    MenuButtonAction::Play => {
702                        game_state.set(GameState::Game);
703                        menu_state.set(MenuState::Disabled);
704                    }
705                    MenuButtonAction::Settings => menu_state.set(MenuState::Settings),
706                    MenuButtonAction::SettingsDisplay => {
707                        menu_state.set(MenuState::SettingsDisplay);
708                    }
709                    MenuButtonAction::SettingsSound => {
710                        menu_state.set(MenuState::SettingsSound);
711                    }
712                    MenuButtonAction::BackToMainMenu => menu_state.set(MenuState::Main),
713                    MenuButtonAction::BackToSettings => {
714                        menu_state.set(MenuState::Settings);
715                    }
716                }
717            }
718        }
719    }
examples/testbed/2d.rs (line 57)
50fn switch_scene(
51    keyboard: Res<ButtonInput<KeyCode>>,
52    scene: Res<State<Scene>>,
53    mut next_scene: ResMut<NextState<Scene>>,
54) {
55    if keyboard.just_pressed(KeyCode::Space) {
56        info!("Switching scene");
57        next_scene.set(scene.get().next());
58    }
59}
examples/testbed/3d.rs (line 68)
61fn switch_scene(
62    keyboard: Res<ButtonInput<KeyCode>>,
63    scene: Res<State<Scene>>,
64    mut next_scene: ResMut<NextState<Scene>>,
65) {
66    if keyboard.just_pressed(KeyCode::Space) {
67        info!("Switching scene");
68        next_scene.set(scene.get().next());
69    }
70}
examples/testbed/ui.rs (line 75)
68fn switch_scene(
69    keyboard: Res<ButtonInput<KeyCode>>,
70    scene: Res<State<Scene>>,
71    mut next_scene: ResMut<NextState<Scene>>,
72) {
73    if keyboard.just_pressed(KeyCode::Space) {
74        info!("Switching scene");
75        next_scene.set(scene.get().next());
76    }
77}
examples/math/render_primitives.rs (line 336)
331fn switch_cameras(current: Res<State<CameraActive>>, mut next: ResMut<NextState<CameraActive>>) {
332    let next_state = match current.get() {
333        CameraActive::Dim2 => CameraActive::Dim3,
334        CameraActive::Dim3 => CameraActive::Dim2,
335    };
336    next.set(next_state);
337}
338
339fn setup_text(mut commands: Commands, cameras: Query<(Entity, &Camera)>) {
340    let active_camera = cameras
341        .iter()
342        .find_map(|(entity, camera)| camera.is_active.then_some(entity))
343        .expect("run condition ensures existence");
344    commands.spawn((
345        HeaderNode,
346        Node {
347            justify_self: JustifySelf::Center,
348            top: px(5),
349            ..Default::default()
350        },
351        UiTargetCamera(active_camera),
352        children![(
353            Text::default(),
354            HeaderText,
355            TextLayout::new_with_justify(Justify::Center),
356            children![
357                TextSpan::new("Primitive: "),
358                TextSpan(format!("{text}", text = PrimitiveSelected::default())),
359                TextSpan::new("\n\n"),
360                TextSpan::new(
361                    "Press 'C' to switch between 2D and 3D mode\n\
362                    Press 'Up' or 'Down' to switch to the next/previous primitive",
363                ),
364                TextSpan::new("\n\n"),
365                TextSpan::new("(If nothing is displayed, there's no rendering support yet)",),
366            ]
367        )],
368    ));
369}
370
371fn update_text(
372    primitive_state: Res<State<PrimitiveSelected>>,
373    header: Query<Entity, With<HeaderText>>,
374    mut writer: TextUiWriter,
375) {
376    let new_text = format!("{text}", text = primitive_state.get());
377    header.iter().for_each(|header_text| {
378        if let Some(mut text) = writer.get_text(header_text, 2) {
379            (*text).clone_from(&new_text);
380        };
381    });
382}
383
384fn switch_to_next_primitive(
385    current: Res<State<PrimitiveSelected>>,
386    mut next: ResMut<NextState<PrimitiveSelected>>,
387) {
388    let next_state = current.get().next();
389    next.set(next_state);
390}
391
392fn switch_to_previous_primitive(
393    current: Res<State<PrimitiveSelected>>,
394    mut next: ResMut<NextState<PrimitiveSelected>>,
395) {
396    let next_state = current.get().previous();
397    next.set(next_state);
398}
Source

pub fn reset(&mut self)

Remove any pending changes to State<S>

Trait Implementations§

Source§

impl<S> Clone for NextState<S>

Source§

fn clone(&self) -> NextState<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S> Debug for NextState<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<S> Default for NextState<S>

Source§

fn default() -> NextState<S>

Returns the “default value” for a type. Read more
Source§

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)>

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)>

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)>

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)>

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>

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>

Returns the name of the field (in the current variant) with the given index. Read more
Source§

fn iter_fields(&self) -> VariantFieldIter<'_>

Returns an iterator over the values of the current variant’s fields.
Source§

fn field_len(&self) -> usize

Returns the number of fields in the current variant.
Source§

fn variant_name(&self) -> &str

The name of the current variant.
Source§

fn variant_index(&self) -> usize

The index of the current variant.
Source§

fn variant_type(&self) -> VariantType

The type of the current variant.
Source§

fn to_dynamic_enum(&self) -> DynamicEnum

Creates a new DynamicEnum from this enum.
Source§

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

Returns the full path to the current variant.
Source§

fn get_represented_enum_info(&self) -> Option<&'static EnumInfo>

Will return None if TypeInfo is not available.
Source§

impl<S> FromArg for NextState<S>
where S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection, NextState<S>: Any + Send + Sync,

Source§

type This<'from_arg> = NextState<S>

The type to convert into. Read more
Source§

fn from_arg( arg: Arg<'_>, ) -> Result<<NextState<S> as FromArg>::This<'_>, ArgError>

Creates an item from an argument. Read more
Source§

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>>

Constructs a concrete instance of Self from a reflected value.
Source§

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 more
Source§

impl<S> GetOwnership for NextState<S>
where S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection, NextState<S>: Any + Send + Sync,

Source§

fn ownership() -> Ownership

Returns the ownership of Self.
Source§

impl<S> GetTypeRegistration for NextState<S>
where S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection, NextState<S>: Any + Send + Sync,

Source§

fn get_type_registration() -> TypeRegistration

Returns the default TypeRegistration for this type.
Source§

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,

Source§

fn into_return<'into_return>(self) -> Return<'into_return>
where NextState<S>: 'into_return,

Converts Self into a Return value.
Source§

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>

Returns the TypeInfo of the type represented by this value. Read more
Source§

fn try_apply( &mut self, __value_param: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>

Tries to apply a reflected value to this value. Read more
Source§

fn reflect_kind(&self) -> ReflectKind

Returns a zero-sized enumeration of “kinds” of type. Read more
Source§

fn reflect_ref(&self) -> ReflectRef<'_>

Returns an immutable enumeration of “kinds” of type. Read more
Source§

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

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>>

Attempts to cast this type to a boxed, fully-reflected value.
Source§

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)>

Attempts to cast this type to a mutable, fully-reflected value.
Source§

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)

Casts this type to a reflected value. Read more
Source§

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>

Returns a hash of the value (which includes the type). Read more
Source§

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>

Debug formatter for the value. Read more
Source§

fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>

Attempts to clone Self using reflection. Read more
Source§

fn apply(&mut self, value: &(dyn PartialReflect + 'static))

Applies a reflected value to this value. Read more
Source§

fn to_dynamic(&self) -> Box<dyn PartialReflect>

Converts this reflected value into its dynamic representation based on its kind. Read more
Source§

fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
where T: 'static, Self: Sized + TypePath,

For a type implementing PartialReflect, combines reflect_clone and take in a useful fashion, automatically constructing an appropriate ReflectCloneError if the downcast fails. Read more
Source§

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,

Source§

fn into_any(self: Box<NextState<S>>) -> Box<dyn Any>

Returns the value as a Box<dyn Any>. Read more
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Returns the value as a &dyn Any. Read more
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Returns the value as a &mut dyn Any. Read more
Source§

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)

Casts this type to a fully-reflected value.
Source§

fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)

Casts this type to a mutable, fully-reflected value.
Source§

fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>

Performs a type-checked assignment of a reflected value to this value. Read more
Source§

impl<S> TypePath for NextState<S>

Source§

fn type_path() -> &'static str

Returns the fully qualified path of the underlying type. Read more
Source§

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>

Returns the name of the type, or None if it is anonymous. Read more
Source§

fn crate_name() -> Option<&'static str>

Returns the name of the crate the type is in, or None if it is anonymous. Read more
Source§

fn module_path() -> Option<&'static str>

Returns the path to the module the type is in, or None if it is anonymous. Read more
Source§

impl<S> Typed for NextState<S>
where S: FreelyMutableState + TypePath + FromReflect + MaybeTyped + RegisterForReflection, NextState<S>: Any + Send + Sync,

Source§

fn type_info() -> &'static TypeInfo

Returns the compile-time info for the underlying type.
Source§

impl<S> Resource for NextState<S>
where S: FreelyMutableState, NextState<S>: Send + Sync + 'static,

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

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> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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 T
where T: Any,

Source§

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>

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)

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)

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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynamicTypePath for T
where T: TypePath,

Source§

impl<T> DynamicTyped for T
where T: Typed,

Source§

impl<T> FmtForward for T

Source§

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,

Causes self to use its Display implementation when Debug-formatted.
Source§

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,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

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,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

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,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> FromWorld for T
where T: Default,

Source§

fn from_world(_world: &mut World) -> T

Creates Self using default().

Source§

impl<T> GetPath for T
where T: Reflect + ?Sized,

Source§

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where 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) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

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§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

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

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
where Self: Borrow<B>, B: ?Sized,

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
where Self: BorrowMut<B>, B: ?Sized,

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
where Self: AsRef<R>, R: ?Sized,

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
where Self: AsMut<R>, R: ?Sized,

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
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypeData for T
where T: 'static + Send + Sync + Clone,

Source§

fn clone_type_data(&self) -> Box<dyn TypeData>

Creates a type-erased clone of this value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> Reflectable for T

Source§

impl<T> Settings for T
where T: 'static + Send + Sync,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,