Struct Overflow

Source
pub struct Overflow {
    pub x: OverflowAxis,
    pub y: OverflowAxis,
}
Expand description

Whether to show or hide overflowing items

Fields§

§x: OverflowAxis

Whether to show or clip overflowing items on the x axis

§y: OverflowAxis

Whether to show or clip overflowing items on the y axis

Implementations§

Source§

impl Overflow

Source

pub const DEFAULT: Overflow

Source

pub const fn visible() -> Overflow

Show overflowing items on both axes

Examples found in repository?
examples/ui/overflow_debug.rs (line 265)
246fn toggle_overflow(
247    mut containers: Query<&mut Node, With<Container>>,
248    instructions: Single<Entity, With<Instructions>>,
249    mut writer: TextUiWriter,
250) {
251    for mut node in &mut containers {
252        node.overflow = match node.overflow {
253            Overflow {
254                x: OverflowAxis::Visible,
255                y: OverflowAxis::Visible,
256            } => Overflow::clip_y(),
257            Overflow {
258                x: OverflowAxis::Visible,
259                y: OverflowAxis::Clip,
260            } => Overflow::clip_x(),
261            Overflow {
262                x: OverflowAxis::Clip,
263                y: OverflowAxis::Visible,
264            } => Overflow::clip(),
265            _ => Overflow::visible(),
266        };
267
268        let entity = *instructions;
269        *writer.text(entity, 1) = format!("{:?}", node.overflow);
270    }
271}
More examples
Hide additional examples
examples/testbed/ui.rs (line 405)
387    pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
388        commands.spawn((Camera2d, StateScoped(super::Scene::Overflow)));
389        let image = asset_server.load("branding/icon.png");
390
391        commands
392            .spawn((
393                Node {
394                    width: Val::Percent(100.),
395                    height: Val::Percent(100.),
396                    align_items: AlignItems::Center,
397                    justify_content: JustifyContent::SpaceAround,
398                    ..Default::default()
399                },
400                BackgroundColor(BLUE.into()),
401                StateScoped(super::Scene::Overflow),
402            ))
403            .with_children(|parent| {
404                for overflow in [
405                    Overflow::visible(),
406                    Overflow::clip_x(),
407                    Overflow::clip_y(),
408                    Overflow::clip(),
409                ] {
410                    parent
411                        .spawn((
412                            Node {
413                                width: Val::Px(100.),
414                                height: Val::Px(100.),
415                                padding: UiRect {
416                                    left: Val::Px(25.),
417                                    top: Val::Px(25.),
418                                    ..Default::default()
419                                },
420                                border: UiRect::all(Val::Px(5.)),
421                                overflow,
422                                ..default()
423                            },
424                            BorderColor(RED.into()),
425                            BackgroundColor(Color::WHITE),
426                        ))
427                        .with_children(|parent| {
428                            parent.spawn((
429                                ImageNode::new(image.clone()),
430                                Node {
431                                    min_width: Val::Px(100.),
432                                    min_height: Val::Px(100.),
433                                    ..default()
434                                },
435                                Interaction::default(),
436                                Outline {
437                                    width: Val::Px(2.),
438                                    offset: Val::Px(2.),
439                                    color: Color::NONE,
440                                },
441                            ));
442                        });
443                }
444            });
445    }
examples/ui/overflow.rs (line 35)
15fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
16    commands.spawn(Camera2d);
17
18    let text_style = TextFont::default();
19
20    let image = asset_server.load("branding/icon.png");
21
22    commands
23        .spawn((
24            Node {
25                width: Val::Percent(100.),
26                height: Val::Percent(100.),
27                align_items: AlignItems::Center,
28                justify_content: JustifyContent::Center,
29                ..Default::default()
30            },
31            BackgroundColor(ANTIQUE_WHITE.into()),
32        ))
33        .with_children(|parent| {
34            for overflow in [
35                Overflow::visible(),
36                Overflow::clip_x(),
37                Overflow::clip_y(),
38                Overflow::clip(),
39            ] {
40                parent
41                    .spawn(Node {
42                        flex_direction: FlexDirection::Column,
43                        align_items: AlignItems::Center,
44                        margin: UiRect::horizontal(Val::Px(25.)),
45                        ..Default::default()
46                    })
47                    .with_children(|parent| {
48                        let label = format!("{overflow:#?}");
49                        parent
50                            .spawn((
51                                Node {
52                                    padding: UiRect::all(Val::Px(10.)),
53                                    margin: UiRect::bottom(Val::Px(25.)),
54                                    ..Default::default()
55                                },
56                                BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
57                            ))
58                            .with_children(|parent| {
59                                parent.spawn((Text::new(label), text_style.clone()));
60                            });
61                        parent
62                            .spawn((
63                                Node {
64                                    width: Val::Px(100.),
65                                    height: Val::Px(100.),
66                                    padding: UiRect {
67                                        left: Val::Px(25.),
68                                        top: Val::Px(25.),
69                                        ..Default::default()
70                                    },
71                                    border: UiRect::all(Val::Px(5.)),
72                                    overflow,
73                                    ..default()
74                                },
75                                BorderColor(Color::BLACK),
76                                BackgroundColor(GRAY.into()),
77                            ))
78                            .with_children(|parent| {
79                                parent.spawn((
80                                    ImageNode::new(image.clone()),
81                                    Node {
82                                        min_width: Val::Px(100.),
83                                        min_height: Val::Px(100.),
84                                        ..default()
85                                    },
86                                    Interaction::default(),
87                                    Outline {
88                                        width: Val::Px(2.),
89                                        offset: Val::Px(2.),
90                                        color: Color::NONE,
91                                    },
92                                ));
93                            });
94                    });
95            }
96        });
97}
Source

pub const fn clip() -> Overflow

Clip overflowing items on both axes

Examples found in repository?
examples/ui/overflow_debug.rs (line 101)
77fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
78    // Camera
79
80    commands.spawn(Camera2d);
81
82    // Instructions
83
84    let text_font = TextFont::default();
85
86    commands
87        .spawn((
88            Text::new(
89                "Next Overflow Setting (O)\nNext Container Size (S)\nToggle Animation (space)\n\n",
90            ),
91            text_font.clone(),
92            Node {
93                position_type: PositionType::Absolute,
94                top: Val::Px(12.0),
95                left: Val::Px(12.0),
96                ..default()
97            },
98            Instructions,
99        ))
100        .with_child((
101            TextSpan::new(format!("{:?}", Overflow::clip())),
102            text_font.clone(),
103        ));
104
105    // Overflow Debug
106
107    commands
108        .spawn(Node {
109            width: Val::Percent(100.),
110            height: Val::Percent(100.),
111            justify_content: JustifyContent::Center,
112            align_items: AlignItems::Center,
113            ..default()
114        })
115        .with_children(|parent| {
116            parent
117                .spawn(Node {
118                    display: Display::Grid,
119                    grid_template_columns: RepeatedGridTrack::px(3, CONTAINER_SIZE),
120                    grid_template_rows: RepeatedGridTrack::px(2, CONTAINER_SIZE),
121                    row_gap: Val::Px(80.),
122                    column_gap: Val::Px(80.),
123                    ..default()
124                })
125                .with_children(|parent| {
126                    spawn_image(parent, &asset_server, Move);
127                    spawn_image(parent, &asset_server, Scale);
128                    spawn_image(parent, &asset_server, Rotate);
129
130                    spawn_text(parent, &asset_server, Move);
131                    spawn_text(parent, &asset_server, Scale);
132                    spawn_text(parent, &asset_server, Rotate);
133                });
134        });
135}
136
137fn spawn_image(
138    parent: &mut ChildSpawnerCommands,
139    asset_server: &Res<AssetServer>,
140    update_transform: impl UpdateTransform + Component,
141) {
142    spawn_container(parent, update_transform, |parent| {
143        parent.spawn((
144            ImageNode::new(asset_server.load("branding/bevy_logo_dark_big.png")),
145            Node {
146                height: Val::Px(100.),
147                position_type: PositionType::Absolute,
148                top: Val::Px(-50.),
149                left: Val::Px(-200.),
150                ..default()
151            },
152        ));
153    });
154}
155
156fn spawn_text(
157    parent: &mut ChildSpawnerCommands,
158    asset_server: &Res<AssetServer>,
159    update_transform: impl UpdateTransform + Component,
160) {
161    spawn_container(parent, update_transform, |parent| {
162        parent.spawn((
163            Text::new("Bevy"),
164            TextFont {
165                font: asset_server.load("fonts/FiraSans-Bold.ttf"),
166                font_size: 100.0,
167                ..default()
168            },
169        ));
170    });
171}
172
173fn spawn_container(
174    parent: &mut ChildSpawnerCommands,
175    update_transform: impl UpdateTransform + Component,
176    spawn_children: impl FnOnce(&mut ChildSpawnerCommands),
177) {
178    let mut transform = Transform::default();
179
180    update_transform.update(0.0, &mut transform);
181
182    parent
183        .spawn((
184            Node {
185                width: Val::Percent(100.),
186                height: Val::Percent(100.),
187                align_items: AlignItems::Center,
188                justify_content: JustifyContent::Center,
189                overflow: Overflow::clip(),
190                ..default()
191            },
192            BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
193            Container(0),
194        ))
195        .with_children(|parent| {
196            parent
197                .spawn((
198                    Node {
199                        align_items: AlignItems::Center,
200                        justify_content: JustifyContent::Center,
201                        top: Val::Px(transform.translation.x),
202                        left: Val::Px(transform.translation.y),
203                        ..default()
204                    },
205                    transform,
206                    update_transform,
207                ))
208                .with_children(spawn_children);
209        });
210}
211
212fn update_animation(
213    mut animation: ResMut<AnimationState>,
214    time: Res<Time>,
215    keys: Res<ButtonInput<KeyCode>>,
216) {
217    let delta = time.elapsed_secs();
218
219    if keys.just_pressed(KeyCode::Space) {
220        animation.playing = !animation.playing;
221
222        if !animation.playing {
223            animation.paused_at = delta;
224        } else {
225            animation.paused_total += delta - animation.paused_at;
226        }
227    }
228
229    if animation.playing {
230        animation.t = (delta - animation.paused_total) % LOOP_LENGTH / LOOP_LENGTH;
231    }
232}
233
234fn update_transform<T: UpdateTransform + Component>(
235    animation: Res<AnimationState>,
236    mut containers: Query<(&mut Transform, &mut Node, &ComputedNode, &T)>,
237) {
238    for (mut transform, mut node, computed_node, update_transform) in &mut containers {
239        update_transform.update(animation.t, &mut transform);
240
241        node.left = Val::Px(transform.translation.x * computed_node.inverse_scale_factor());
242        node.top = Val::Px(transform.translation.y * computed_node.inverse_scale_factor());
243    }
244}
245
246fn toggle_overflow(
247    mut containers: Query<&mut Node, With<Container>>,
248    instructions: Single<Entity, With<Instructions>>,
249    mut writer: TextUiWriter,
250) {
251    for mut node in &mut containers {
252        node.overflow = match node.overflow {
253            Overflow {
254                x: OverflowAxis::Visible,
255                y: OverflowAxis::Visible,
256            } => Overflow::clip_y(),
257            Overflow {
258                x: OverflowAxis::Visible,
259                y: OverflowAxis::Clip,
260            } => Overflow::clip_x(),
261            Overflow {
262                x: OverflowAxis::Clip,
263                y: OverflowAxis::Visible,
264            } => Overflow::clip(),
265            _ => Overflow::visible(),
266        };
267
268        let entity = *instructions;
269        *writer.text(entity, 1) = format!("{:?}", node.overflow);
270    }
271}
More examples
Hide additional examples
examples/testbed/ui.rs (line 408)
387    pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
388        commands.spawn((Camera2d, StateScoped(super::Scene::Overflow)));
389        let image = asset_server.load("branding/icon.png");
390
391        commands
392            .spawn((
393                Node {
394                    width: Val::Percent(100.),
395                    height: Val::Percent(100.),
396                    align_items: AlignItems::Center,
397                    justify_content: JustifyContent::SpaceAround,
398                    ..Default::default()
399                },
400                BackgroundColor(BLUE.into()),
401                StateScoped(super::Scene::Overflow),
402            ))
403            .with_children(|parent| {
404                for overflow in [
405                    Overflow::visible(),
406                    Overflow::clip_x(),
407                    Overflow::clip_y(),
408                    Overflow::clip(),
409                ] {
410                    parent
411                        .spawn((
412                            Node {
413                                width: Val::Px(100.),
414                                height: Val::Px(100.),
415                                padding: UiRect {
416                                    left: Val::Px(25.),
417                                    top: Val::Px(25.),
418                                    ..Default::default()
419                                },
420                                border: UiRect::all(Val::Px(5.)),
421                                overflow,
422                                ..default()
423                            },
424                            BorderColor(RED.into()),
425                            BackgroundColor(Color::WHITE),
426                        ))
427                        .with_children(|parent| {
428                            parent.spawn((
429                                ImageNode::new(image.clone()),
430                                Node {
431                                    min_width: Val::Px(100.),
432                                    min_height: Val::Px(100.),
433                                    ..default()
434                                },
435                                Interaction::default(),
436                                Outline {
437                                    width: Val::Px(2.),
438                                    offset: Val::Px(2.),
439                                    color: Color::NONE,
440                                },
441                            ));
442                        });
443                }
444            });
445    }
examples/ui/overflow.rs (line 38)
15fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
16    commands.spawn(Camera2d);
17
18    let text_style = TextFont::default();
19
20    let image = asset_server.load("branding/icon.png");
21
22    commands
23        .spawn((
24            Node {
25                width: Val::Percent(100.),
26                height: Val::Percent(100.),
27                align_items: AlignItems::Center,
28                justify_content: JustifyContent::Center,
29                ..Default::default()
30            },
31            BackgroundColor(ANTIQUE_WHITE.into()),
32        ))
33        .with_children(|parent| {
34            for overflow in [
35                Overflow::visible(),
36                Overflow::clip_x(),
37                Overflow::clip_y(),
38                Overflow::clip(),
39            ] {
40                parent
41                    .spawn(Node {
42                        flex_direction: FlexDirection::Column,
43                        align_items: AlignItems::Center,
44                        margin: UiRect::horizontal(Val::Px(25.)),
45                        ..Default::default()
46                    })
47                    .with_children(|parent| {
48                        let label = format!("{overflow:#?}");
49                        parent
50                            .spawn((
51                                Node {
52                                    padding: UiRect::all(Val::Px(10.)),
53                                    margin: UiRect::bottom(Val::Px(25.)),
54                                    ..Default::default()
55                                },
56                                BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
57                            ))
58                            .with_children(|parent| {
59                                parent.spawn((Text::new(label), text_style.clone()));
60                            });
61                        parent
62                            .spawn((
63                                Node {
64                                    width: Val::Px(100.),
65                                    height: Val::Px(100.),
66                                    padding: UiRect {
67                                        left: Val::Px(25.),
68                                        top: Val::Px(25.),
69                                        ..Default::default()
70                                    },
71                                    border: UiRect::all(Val::Px(5.)),
72                                    overflow,
73                                    ..default()
74                                },
75                                BorderColor(Color::BLACK),
76                                BackgroundColor(GRAY.into()),
77                            ))
78                            .with_children(|parent| {
79                                parent.spawn((
80                                    ImageNode::new(image.clone()),
81                                    Node {
82                                        min_width: Val::Px(100.),
83                                        min_height: Val::Px(100.),
84                                        ..default()
85                                    },
86                                    Interaction::default(),
87                                    Outline {
88                                        width: Val::Px(2.),
89                                        offset: Val::Px(2.),
90                                        color: Color::NONE,
91                                    },
92                                ));
93                            });
94                    });
95            }
96        });
97}
examples/ui/overflow_clip_margin.rs (line 65)
14fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
15    commands.spawn(Camera2d);
16
17    let image = asset_server.load("branding/icon.png");
18
19    commands
20        .spawn((
21            Node {
22                width: Val::Percent(100.),
23                height: Val::Percent(100.),
24                align_items: AlignItems::Center,
25                justify_content: JustifyContent::Center,
26                row_gap: Val::Px(40.),
27                flex_direction: FlexDirection::Column,
28                ..default()
29            },
30            BackgroundColor(ANTIQUE_WHITE.into()),
31        ))
32        .with_children(|parent| {
33            for overflow_clip_margin in [
34                OverflowClipMargin::border_box().with_margin(25.),
35                OverflowClipMargin::border_box(),
36                OverflowClipMargin::padding_box(),
37                OverflowClipMargin::content_box(),
38            ] {
39                parent
40                    .spawn(Node {
41                        flex_direction: FlexDirection::Row,
42                        column_gap: Val::Px(20.),
43                        ..default()
44                    })
45                    .with_children(|parent| {
46                        parent
47                            .spawn((
48                                Node {
49                                    padding: UiRect::all(Val::Px(10.)),
50                                    margin: UiRect::bottom(Val::Px(25.)),
51                                    ..default()
52                                },
53                                BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
54                            ))
55                            .with_child(Text(format!("{overflow_clip_margin:#?}")));
56
57                        parent
58                            .spawn((
59                                Node {
60                                    margin: UiRect::top(Val::Px(10.)),
61                                    width: Val::Px(100.),
62                                    height: Val::Px(100.),
63                                    padding: UiRect::all(Val::Px(20.)),
64                                    border: UiRect::all(Val::Px(5.)),
65                                    overflow: Overflow::clip(),
66                                    overflow_clip_margin,
67                                    ..default()
68                                },
69                                BackgroundColor(GRAY.into()),
70                                BorderColor(Color::BLACK),
71                            ))
72                            .with_children(|parent| {
73                                parent
74                                    .spawn((
75                                        Node {
76                                            min_width: Val::Px(50.),
77                                            min_height: Val::Px(50.),
78                                            ..default()
79                                        },
80                                        BackgroundColor(LIGHT_CYAN.into()),
81                                    ))
82                                    .with_child((
83                                        ImageNode::new(image.clone()),
84                                        Node {
85                                            min_width: Val::Px(100.),
86                                            min_height: Val::Px(100.),
87                                            ..default()
88                                        },
89                                    ));
90                            });
91                    });
92            }
93        });
94}
Source

pub const fn clip_x() -> Overflow

Clip overflowing items on the x axis

Examples found in repository?
examples/ui/overflow_debug.rs (line 260)
246fn toggle_overflow(
247    mut containers: Query<&mut Node, With<Container>>,
248    instructions: Single<Entity, With<Instructions>>,
249    mut writer: TextUiWriter,
250) {
251    for mut node in &mut containers {
252        node.overflow = match node.overflow {
253            Overflow {
254                x: OverflowAxis::Visible,
255                y: OverflowAxis::Visible,
256            } => Overflow::clip_y(),
257            Overflow {
258                x: OverflowAxis::Visible,
259                y: OverflowAxis::Clip,
260            } => Overflow::clip_x(),
261            Overflow {
262                x: OverflowAxis::Clip,
263                y: OverflowAxis::Visible,
264            } => Overflow::clip(),
265            _ => Overflow::visible(),
266        };
267
268        let entity = *instructions;
269        *writer.text(entity, 1) = format!("{:?}", node.overflow);
270    }
271}
More examples
Hide additional examples
examples/testbed/ui.rs (line 354)
345    pub fn setup(mut commands: Commands) {
346        commands.spawn((Camera2d, StateScoped(super::Scene::TextWrap)));
347
348        let root = commands
349            .spawn((
350                Node {
351                    flex_direction: FlexDirection::Column,
352                    width: Val::Px(200.),
353                    height: Val::Percent(100.),
354                    overflow: Overflow::clip_x(),
355                    ..default()
356                },
357                BackgroundColor(Color::BLACK),
358                StateScoped(super::Scene::TextWrap),
359            ))
360            .id();
361
362        for linebreak in [
363            LineBreak::AnyCharacter,
364            LineBreak::WordBoundary,
365            LineBreak::WordOrCharacter,
366            LineBreak::NoWrap,
367        ] {
368            let messages = [
369                "Lorem ipsum dolor sit amet, consectetur adipiscing elit.".to_string(),
370                "pneumonoultramicroscopicsilicovolcanoconiosis".to_string(),
371            ];
372
373            for (j, message) in messages.into_iter().enumerate() {
374                commands.entity(root).with_child((
375                    Text(message.clone()),
376                    TextLayout::new(JustifyText::Left, linebreak),
377                    BackgroundColor(Color::srgb(0.8 - j as f32 * 0.3, 0., 0.)),
378                ));
379            }
380        }
381    }
382}
383
384mod overflow {
385    use bevy::{color::palettes::css::*, prelude::*};
386
387    pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
388        commands.spawn((Camera2d, StateScoped(super::Scene::Overflow)));
389        let image = asset_server.load("branding/icon.png");
390
391        commands
392            .spawn((
393                Node {
394                    width: Val::Percent(100.),
395                    height: Val::Percent(100.),
396                    align_items: AlignItems::Center,
397                    justify_content: JustifyContent::SpaceAround,
398                    ..Default::default()
399                },
400                BackgroundColor(BLUE.into()),
401                StateScoped(super::Scene::Overflow),
402            ))
403            .with_children(|parent| {
404                for overflow in [
405                    Overflow::visible(),
406                    Overflow::clip_x(),
407                    Overflow::clip_y(),
408                    Overflow::clip(),
409                ] {
410                    parent
411                        .spawn((
412                            Node {
413                                width: Val::Px(100.),
414                                height: Val::Px(100.),
415                                padding: UiRect {
416                                    left: Val::Px(25.),
417                                    top: Val::Px(25.),
418                                    ..Default::default()
419                                },
420                                border: UiRect::all(Val::Px(5.)),
421                                overflow,
422                                ..default()
423                            },
424                            BorderColor(RED.into()),
425                            BackgroundColor(Color::WHITE),
426                        ))
427                        .with_children(|parent| {
428                            parent.spawn((
429                                ImageNode::new(image.clone()),
430                                Node {
431                                    min_width: Val::Px(100.),
432                                    min_height: Val::Px(100.),
433                                    ..default()
434                                },
435                                Interaction::default(),
436                                Outline {
437                                    width: Val::Px(2.),
438                                    offset: Val::Px(2.),
439                                    color: Color::NONE,
440                                },
441                            ));
442                        });
443                }
444            });
445    }
examples/ui/text_wrap_debug.rs (line 101)
45fn spawn(mut commands: Commands, asset_server: Res<AssetServer>) {
46    commands.spawn(Camera2d);
47
48    let text_font = TextFont {
49        font: asset_server.load("fonts/FiraSans-Bold.ttf"),
50        font_size: 12.0,
51        ..default()
52    };
53
54    let root = commands
55        .spawn((
56            Node {
57                width: Val::Percent(100.),
58                height: Val::Percent(100.),
59                flex_direction: FlexDirection::Column,
60                ..default()
61            },
62            BackgroundColor(Color::BLACK),
63        ))
64        .id();
65
66    for linebreak in [
67        LineBreak::AnyCharacter,
68        LineBreak::WordBoundary,
69        LineBreak::WordOrCharacter,
70        LineBreak::NoWrap,
71    ] {
72        let row_id = commands
73            .spawn(Node {
74                flex_direction: FlexDirection::Row,
75                justify_content: JustifyContent::SpaceAround,
76                align_items: AlignItems::Center,
77                width: Val::Percent(100.),
78                height: Val::Percent(50.),
79                ..default()
80            })
81            .id();
82
83        let justifications = vec![
84            JustifyContent::Center,
85            JustifyContent::FlexStart,
86            JustifyContent::FlexEnd,
87            JustifyContent::SpaceAround,
88            JustifyContent::SpaceBetween,
89            JustifyContent::SpaceEvenly,
90        ];
91
92        for (i, justification) in justifications.into_iter().enumerate() {
93            let c = 0.3 + i as f32 * 0.1;
94            let column_id = commands
95                .spawn((
96                    Node {
97                        justify_content: justification,
98                        flex_direction: FlexDirection::Column,
99                        width: Val::Percent(16.),
100                        height: Val::Percent(95.),
101                        overflow: Overflow::clip_x(),
102                        ..default()
103                    },
104                    BackgroundColor(Color::srgb(0.5, c, 1.0 - c)),
105                ))
106                .id();
107
108            let messages = [
109                format!("JustifyContent::{justification:?}"),
110                format!("LineBreakOn::{linebreak:?}"),
111                "Line 1\nLine 2".to_string(),
112                "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas auctor, nunc ac faucibus fringilla.".to_string(),
113                "pneumonoultramicroscopicsilicovolcanoconiosis".to_string()
114            ];
115
116            for (j, message) in messages.into_iter().enumerate() {
117                commands.entity(column_id).with_child((
118                    Text(message.clone()),
119                    text_font.clone(),
120                    TextLayout::new(JustifyText::Left, linebreak),
121                    BackgroundColor(Color::srgb(0.8 - j as f32 * 0.2, 0., 0.)),
122                ));
123            }
124            commands.entity(row_id).add_child(column_id);
125        }
126        commands.entity(root).add_child(row_id);
127    }
128}
examples/ui/overflow.rs (line 36)
15fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
16    commands.spawn(Camera2d);
17
18    let text_style = TextFont::default();
19
20    let image = asset_server.load("branding/icon.png");
21
22    commands
23        .spawn((
24            Node {
25                width: Val::Percent(100.),
26                height: Val::Percent(100.),
27                align_items: AlignItems::Center,
28                justify_content: JustifyContent::Center,
29                ..Default::default()
30            },
31            BackgroundColor(ANTIQUE_WHITE.into()),
32        ))
33        .with_children(|parent| {
34            for overflow in [
35                Overflow::visible(),
36                Overflow::clip_x(),
37                Overflow::clip_y(),
38                Overflow::clip(),
39            ] {
40                parent
41                    .spawn(Node {
42                        flex_direction: FlexDirection::Column,
43                        align_items: AlignItems::Center,
44                        margin: UiRect::horizontal(Val::Px(25.)),
45                        ..Default::default()
46                    })
47                    .with_children(|parent| {
48                        let label = format!("{overflow:#?}");
49                        parent
50                            .spawn((
51                                Node {
52                                    padding: UiRect::all(Val::Px(10.)),
53                                    margin: UiRect::bottom(Val::Px(25.)),
54                                    ..Default::default()
55                                },
56                                BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
57                            ))
58                            .with_children(|parent| {
59                                parent.spawn((Text::new(label), text_style.clone()));
60                            });
61                        parent
62                            .spawn((
63                                Node {
64                                    width: Val::Px(100.),
65                                    height: Val::Px(100.),
66                                    padding: UiRect {
67                                        left: Val::Px(25.),
68                                        top: Val::Px(25.),
69                                        ..Default::default()
70                                    },
71                                    border: UiRect::all(Val::Px(5.)),
72                                    overflow,
73                                    ..default()
74                                },
75                                BorderColor(Color::BLACK),
76                                BackgroundColor(GRAY.into()),
77                            ))
78                            .with_children(|parent| {
79                                parent.spawn((
80                                    ImageNode::new(image.clone()),
81                                    Node {
82                                        min_width: Val::Px(100.),
83                                        min_height: Val::Px(100.),
84                                        ..default()
85                                    },
86                                    Interaction::default(),
87                                    Outline {
88                                        width: Val::Px(2.),
89                                        offset: Val::Px(2.),
90                                        color: Color::NONE,
91                                    },
92                                ));
93                            });
94                    });
95            }
96        });
97}
Source

pub const fn clip_y() -> Overflow

Clip overflowing items on the y axis

Examples found in repository?
examples/ui/overflow_debug.rs (line 256)
246fn toggle_overflow(
247    mut containers: Query<&mut Node, With<Container>>,
248    instructions: Single<Entity, With<Instructions>>,
249    mut writer: TextUiWriter,
250) {
251    for mut node in &mut containers {
252        node.overflow = match node.overflow {
253            Overflow {
254                x: OverflowAxis::Visible,
255                y: OverflowAxis::Visible,
256            } => Overflow::clip_y(),
257            Overflow {
258                x: OverflowAxis::Visible,
259                y: OverflowAxis::Clip,
260            } => Overflow::clip_x(),
261            Overflow {
262                x: OverflowAxis::Clip,
263                y: OverflowAxis::Visible,
264            } => Overflow::clip(),
265            _ => Overflow::visible(),
266        };
267
268        let entity = *instructions;
269        *writer.text(entity, 1) = format!("{:?}", node.overflow);
270    }
271}
More examples
Hide additional examples
examples/testbed/ui.rs (line 407)
387    pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
388        commands.spawn((Camera2d, StateScoped(super::Scene::Overflow)));
389        let image = asset_server.load("branding/icon.png");
390
391        commands
392            .spawn((
393                Node {
394                    width: Val::Percent(100.),
395                    height: Val::Percent(100.),
396                    align_items: AlignItems::Center,
397                    justify_content: JustifyContent::SpaceAround,
398                    ..Default::default()
399                },
400                BackgroundColor(BLUE.into()),
401                StateScoped(super::Scene::Overflow),
402            ))
403            .with_children(|parent| {
404                for overflow in [
405                    Overflow::visible(),
406                    Overflow::clip_x(),
407                    Overflow::clip_y(),
408                    Overflow::clip(),
409                ] {
410                    parent
411                        .spawn((
412                            Node {
413                                width: Val::Px(100.),
414                                height: Val::Px(100.),
415                                padding: UiRect {
416                                    left: Val::Px(25.),
417                                    top: Val::Px(25.),
418                                    ..Default::default()
419                                },
420                                border: UiRect::all(Val::Px(5.)),
421                                overflow,
422                                ..default()
423                            },
424                            BorderColor(RED.into()),
425                            BackgroundColor(Color::WHITE),
426                        ))
427                        .with_children(|parent| {
428                            parent.spawn((
429                                ImageNode::new(image.clone()),
430                                Node {
431                                    min_width: Val::Px(100.),
432                                    min_height: Val::Px(100.),
433                                    ..default()
434                                },
435                                Interaction::default(),
436                                Outline {
437                                    width: Val::Px(2.),
438                                    offset: Val::Px(2.),
439                                    color: Color::NONE,
440                                },
441                            ));
442                        });
443                }
444            });
445    }
examples/ui/overflow.rs (line 37)
15fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
16    commands.spawn(Camera2d);
17
18    let text_style = TextFont::default();
19
20    let image = asset_server.load("branding/icon.png");
21
22    commands
23        .spawn((
24            Node {
25                width: Val::Percent(100.),
26                height: Val::Percent(100.),
27                align_items: AlignItems::Center,
28                justify_content: JustifyContent::Center,
29                ..Default::default()
30            },
31            BackgroundColor(ANTIQUE_WHITE.into()),
32        ))
33        .with_children(|parent| {
34            for overflow in [
35                Overflow::visible(),
36                Overflow::clip_x(),
37                Overflow::clip_y(),
38                Overflow::clip(),
39            ] {
40                parent
41                    .spawn(Node {
42                        flex_direction: FlexDirection::Column,
43                        align_items: AlignItems::Center,
44                        margin: UiRect::horizontal(Val::Px(25.)),
45                        ..Default::default()
46                    })
47                    .with_children(|parent| {
48                        let label = format!("{overflow:#?}");
49                        parent
50                            .spawn((
51                                Node {
52                                    padding: UiRect::all(Val::Px(10.)),
53                                    margin: UiRect::bottom(Val::Px(25.)),
54                                    ..Default::default()
55                                },
56                                BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
57                            ))
58                            .with_children(|parent| {
59                                parent.spawn((Text::new(label), text_style.clone()));
60                            });
61                        parent
62                            .spawn((
63                                Node {
64                                    width: Val::Px(100.),
65                                    height: Val::Px(100.),
66                                    padding: UiRect {
67                                        left: Val::Px(25.),
68                                        top: Val::Px(25.),
69                                        ..Default::default()
70                                    },
71                                    border: UiRect::all(Val::Px(5.)),
72                                    overflow,
73                                    ..default()
74                                },
75                                BorderColor(Color::BLACK),
76                                BackgroundColor(GRAY.into()),
77                            ))
78                            .with_children(|parent| {
79                                parent.spawn((
80                                    ImageNode::new(image.clone()),
81                                    Node {
82                                        min_width: Val::Px(100.),
83                                        min_height: Val::Px(100.),
84                                        ..default()
85                                    },
86                                    Interaction::default(),
87                                    Outline {
88                                        width: Val::Px(2.),
89                                        offset: Val::Px(2.),
90                                        color: Color::NONE,
91                                    },
92                                ));
93                            });
94                    });
95            }
96        });
97}
Source

pub const fn hidden() -> Overflow

Hide overflowing items on both axes by influencing layout and then clipping

Source

pub const fn hidden_x() -> Overflow

Hide overflowing items on the x axis by influencing layout and then clipping

Source

pub const fn hidden_y() -> Overflow

Hide overflowing items on the y axis by influencing layout and then clipping

Source

pub const fn is_visible(&self) -> bool

Overflow is visible on both axes

Source

pub const fn scroll() -> Overflow

Examples found in repository?
examples/ui/scroll.rs (line 208)
25fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
26    // Camera
27    commands.spawn((Camera2d, IsDefaultUiCamera));
28
29    // root node
30    commands
31        .spawn(Node {
32            width: Val::Percent(100.0),
33            height: Val::Percent(100.0),
34            justify_content: JustifyContent::SpaceBetween,
35            flex_direction: FlexDirection::Column,
36            ..default()
37        })
38        .insert(Pickable::IGNORE)
39        .with_children(|parent| {
40            // horizontal scroll example
41            parent
42                .spawn(Node {
43                    width: Val::Percent(100.),
44                    flex_direction: FlexDirection::Column,
45                    ..default()
46                })
47                .with_children(|parent| {
48                    // header
49                    parent.spawn((
50                        Text::new("Horizontally Scrolling list (Ctrl + MouseWheel)"),
51                        TextFont {
52                            font: asset_server.load("fonts/FiraSans-Bold.ttf"),
53                            font_size: FONT_SIZE,
54                            ..default()
55                        },
56                        Label,
57                    ));
58
59                    // horizontal scroll container
60                    parent
61                        .spawn((
62                            Node {
63                                width: Val::Percent(80.),
64                                margin: UiRect::all(Val::Px(10.)),
65                                flex_direction: FlexDirection::Row,
66                                overflow: Overflow::scroll_x(), // n.b.
67                                ..default()
68                            },
69                            BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
70                        ))
71                        .with_children(|parent| {
72                            for i in 0..100 {
73                                parent.spawn((Text(format!("Item {i}")),
74                                        TextFont {
75                                            font: asset_server
76                                                .load("fonts/FiraSans-Bold.ttf"),
77                                            ..default()
78                                        },
79                                    Label,
80                                    AccessibilityNode(Accessible::new(Role::ListItem)),
81                                ))
82                                .insert(Node {
83                                    min_width: Val::Px(200.),
84                                    align_content: AlignContent::Center,
85                                    ..default()
86                                })
87                                .insert(Pickable {
88                                    should_block_lower: false,
89                                    ..default()
90                                })
91                                .observe(|
92                                    trigger: Trigger<Pointer<Pressed>>,
93                                    mut commands: Commands
94                                | {
95                                    if trigger.event().button == PointerButton::Primary {
96                                        commands.entity(trigger.target()).despawn();
97                                    }
98                                });
99                            }
100                        });
101                });
102
103            // container for all other examples
104            parent
105                .spawn(Node {
106                    width: Val::Percent(100.),
107                    height: Val::Percent(100.),
108                    flex_direction: FlexDirection::Row,
109                    justify_content: JustifyContent::SpaceBetween,
110                    ..default()
111                })
112                .with_children(|parent| {
113                    // vertical scroll example
114                    parent
115                        .spawn(Node {
116                            flex_direction: FlexDirection::Column,
117                            justify_content: JustifyContent::Center,
118                            align_items: AlignItems::Center,
119                            width: Val::Px(200.),
120                            ..default()
121                        })
122                        .with_children(|parent| {
123                            // Title
124                            parent.spawn((
125                                Text::new("Vertically Scrolling List"),
126                                TextFont {
127                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
128                                    font_size: FONT_SIZE,
129                                    ..default()
130                                },
131                                Label,
132                            ));
133                            // Scrolling list
134                            parent
135                                .spawn((
136                                    Node {
137                                        flex_direction: FlexDirection::Column,
138                                        align_self: AlignSelf::Stretch,
139                                        height: Val::Percent(50.),
140                                        overflow: Overflow::scroll_y(), // n.b.
141                                        ..default()
142                                    },
143                                    BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
144                                ))
145                                .with_children(|parent| {
146                                    // List items
147                                    for i in 0..25 {
148                                        parent
149                                            .spawn(Node {
150                                                min_height: Val::Px(LINE_HEIGHT),
151                                                max_height: Val::Px(LINE_HEIGHT),
152                                                ..default()
153                                            })
154                                            .insert(Pickable {
155                                                should_block_lower: false,
156                                                ..default()
157                                            })
158                                            .with_children(|parent| {
159                                                parent
160                                                    .spawn((
161                                                        Text(format!("Item {i}")),
162                                                        TextFont {
163                                                            font: asset_server
164                                                                .load("fonts/FiraSans-Bold.ttf"),
165                                                            ..default()
166                                                        },
167                                                        Label,
168                                                        AccessibilityNode(Accessible::new(
169                                                            Role::ListItem,
170                                                        )),
171                                                    ))
172                                                    .insert(Pickable {
173                                                        should_block_lower: false,
174                                                        ..default()
175                                                    });
176                                            });
177                                    }
178                                });
179                        });
180
181                    // Bidirectional scroll example
182                    parent
183                        .spawn(Node {
184                            flex_direction: FlexDirection::Column,
185                            justify_content: JustifyContent::Center,
186                            align_items: AlignItems::Center,
187                            width: Val::Px(200.),
188                            ..default()
189                        })
190                        .with_children(|parent| {
191                            // Title
192                            parent.spawn((
193                                Text::new("Bidirectionally Scrolling List"),
194                                TextFont {
195                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
196                                    font_size: FONT_SIZE,
197                                    ..default()
198                                },
199                                Label,
200                            ));
201                            // Scrolling list
202                            parent
203                                .spawn((
204                                    Node {
205                                        flex_direction: FlexDirection::Column,
206                                        align_self: AlignSelf::Stretch,
207                                        height: Val::Percent(50.),
208                                        overflow: Overflow::scroll(), // n.b.
209                                        ..default()
210                                    },
211                                    BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
212                                ))
213                                .with_children(|parent| {
214                                    // Rows in each column
215                                    for oi in 0..10 {
216                                        parent
217                                            .spawn(Node {
218                                                flex_direction: FlexDirection::Row,
219                                                ..default()
220                                            })
221                                            .insert(Pickable::IGNORE)
222                                            .with_children(|parent| {
223                                                // Elements in each row
224                                                for i in 0..25 {
225                                                    parent
226                                                        .spawn((
227                                                            Text(format!("Item {}", (oi * 25) + i)),
228                                                            TextFont {
229                                                                font: asset_server.load(
230                                                                    "fonts/FiraSans-Bold.ttf",
231                                                                ),
232                                                                ..default()
233                                                            },
234                                                            Label,
235                                                            AccessibilityNode(Accessible::new(
236                                                                Role::ListItem,
237                                                            )),
238                                                        ))
239                                                        .insert(Pickable {
240                                                            should_block_lower: false,
241                                                            ..default()
242                                                        });
243                                                }
244                                            });
245                                    }
246                                });
247                        });
248
249                    // Nested scrolls example
250                    parent
251                        .spawn(Node {
252                            flex_direction: FlexDirection::Column,
253                            justify_content: JustifyContent::Center,
254                            align_items: AlignItems::Center,
255                            width: Val::Px(200.),
256                            ..default()
257                        })
258                        .with_children(|parent| {
259                            // Title
260                            parent.spawn((
261                                Text::new("Nested Scrolling Lists"),
262                                TextFont {
263                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
264                                    font_size: FONT_SIZE,
265                                    ..default()
266                                },
267                                Label,
268                            ));
269                            // Outer, horizontal scrolling container
270                            parent
271                                .spawn((
272                                    Node {
273                                        column_gap: Val::Px(20.),
274                                        flex_direction: FlexDirection::Row,
275                                        align_self: AlignSelf::Stretch,
276                                        height: Val::Percent(50.),
277                                        overflow: Overflow::scroll_x(), // n.b.
278                                        ..default()
279                                    },
280                                    BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
281                                ))
282                                .with_children(|parent| {
283                                    // Inner, scrolling columns
284                                    for oi in 0..30 {
285                                        parent
286                                            .spawn((
287                                                Node {
288                                                    flex_direction: FlexDirection::Column,
289                                                    align_self: AlignSelf::Stretch,
290                                                    overflow: Overflow::scroll_y(),
291                                                    ..default()
292                                                },
293                                                BackgroundColor(Color::srgb(0.05, 0.05, 0.05)),
294                                            ))
295                                            .insert(Pickable {
296                                                should_block_lower: false,
297                                                ..default()
298                                            })
299                                            .with_children(|parent| {
300                                                for i in 0..25 {
301                                                    parent
302                                                        .spawn((
303                                                            Text(format!("Item {}", (oi * 25) + i)),
304                                                            TextFont {
305                                                                font: asset_server.load(
306                                                                    "fonts/FiraSans-Bold.ttf",
307                                                                ),
308                                                                ..default()
309                                                            },
310                                                            Label,
311                                                            AccessibilityNode(Accessible::new(
312                                                                Role::ListItem,
313                                                            )),
314                                                        ))
315                                                        .insert(Pickable {
316                                                            should_block_lower: false,
317                                                            ..default()
318                                                        });
319                                                }
320                                            });
321                                    }
322                                });
323                        });
324                });
325        });
326}
Source

pub const fn scroll_x() -> Overflow

Scroll overflowing items on the x axis

Examples found in repository?
examples/ui/scroll.rs (line 66)
25fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
26    // Camera
27    commands.spawn((Camera2d, IsDefaultUiCamera));
28
29    // root node
30    commands
31        .spawn(Node {
32            width: Val::Percent(100.0),
33            height: Val::Percent(100.0),
34            justify_content: JustifyContent::SpaceBetween,
35            flex_direction: FlexDirection::Column,
36            ..default()
37        })
38        .insert(Pickable::IGNORE)
39        .with_children(|parent| {
40            // horizontal scroll example
41            parent
42                .spawn(Node {
43                    width: Val::Percent(100.),
44                    flex_direction: FlexDirection::Column,
45                    ..default()
46                })
47                .with_children(|parent| {
48                    // header
49                    parent.spawn((
50                        Text::new("Horizontally Scrolling list (Ctrl + MouseWheel)"),
51                        TextFont {
52                            font: asset_server.load("fonts/FiraSans-Bold.ttf"),
53                            font_size: FONT_SIZE,
54                            ..default()
55                        },
56                        Label,
57                    ));
58
59                    // horizontal scroll container
60                    parent
61                        .spawn((
62                            Node {
63                                width: Val::Percent(80.),
64                                margin: UiRect::all(Val::Px(10.)),
65                                flex_direction: FlexDirection::Row,
66                                overflow: Overflow::scroll_x(), // n.b.
67                                ..default()
68                            },
69                            BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
70                        ))
71                        .with_children(|parent| {
72                            for i in 0..100 {
73                                parent.spawn((Text(format!("Item {i}")),
74                                        TextFont {
75                                            font: asset_server
76                                                .load("fonts/FiraSans-Bold.ttf"),
77                                            ..default()
78                                        },
79                                    Label,
80                                    AccessibilityNode(Accessible::new(Role::ListItem)),
81                                ))
82                                .insert(Node {
83                                    min_width: Val::Px(200.),
84                                    align_content: AlignContent::Center,
85                                    ..default()
86                                })
87                                .insert(Pickable {
88                                    should_block_lower: false,
89                                    ..default()
90                                })
91                                .observe(|
92                                    trigger: Trigger<Pointer<Pressed>>,
93                                    mut commands: Commands
94                                | {
95                                    if trigger.event().button == PointerButton::Primary {
96                                        commands.entity(trigger.target()).despawn();
97                                    }
98                                });
99                            }
100                        });
101                });
102
103            // container for all other examples
104            parent
105                .spawn(Node {
106                    width: Val::Percent(100.),
107                    height: Val::Percent(100.),
108                    flex_direction: FlexDirection::Row,
109                    justify_content: JustifyContent::SpaceBetween,
110                    ..default()
111                })
112                .with_children(|parent| {
113                    // vertical scroll example
114                    parent
115                        .spawn(Node {
116                            flex_direction: FlexDirection::Column,
117                            justify_content: JustifyContent::Center,
118                            align_items: AlignItems::Center,
119                            width: Val::Px(200.),
120                            ..default()
121                        })
122                        .with_children(|parent| {
123                            // Title
124                            parent.spawn((
125                                Text::new("Vertically Scrolling List"),
126                                TextFont {
127                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
128                                    font_size: FONT_SIZE,
129                                    ..default()
130                                },
131                                Label,
132                            ));
133                            // Scrolling list
134                            parent
135                                .spawn((
136                                    Node {
137                                        flex_direction: FlexDirection::Column,
138                                        align_self: AlignSelf::Stretch,
139                                        height: Val::Percent(50.),
140                                        overflow: Overflow::scroll_y(), // n.b.
141                                        ..default()
142                                    },
143                                    BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
144                                ))
145                                .with_children(|parent| {
146                                    // List items
147                                    for i in 0..25 {
148                                        parent
149                                            .spawn(Node {
150                                                min_height: Val::Px(LINE_HEIGHT),
151                                                max_height: Val::Px(LINE_HEIGHT),
152                                                ..default()
153                                            })
154                                            .insert(Pickable {
155                                                should_block_lower: false,
156                                                ..default()
157                                            })
158                                            .with_children(|parent| {
159                                                parent
160                                                    .spawn((
161                                                        Text(format!("Item {i}")),
162                                                        TextFont {
163                                                            font: asset_server
164                                                                .load("fonts/FiraSans-Bold.ttf"),
165                                                            ..default()
166                                                        },
167                                                        Label,
168                                                        AccessibilityNode(Accessible::new(
169                                                            Role::ListItem,
170                                                        )),
171                                                    ))
172                                                    .insert(Pickable {
173                                                        should_block_lower: false,
174                                                        ..default()
175                                                    });
176                                            });
177                                    }
178                                });
179                        });
180
181                    // Bidirectional scroll example
182                    parent
183                        .spawn(Node {
184                            flex_direction: FlexDirection::Column,
185                            justify_content: JustifyContent::Center,
186                            align_items: AlignItems::Center,
187                            width: Val::Px(200.),
188                            ..default()
189                        })
190                        .with_children(|parent| {
191                            // Title
192                            parent.spawn((
193                                Text::new("Bidirectionally Scrolling List"),
194                                TextFont {
195                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
196                                    font_size: FONT_SIZE,
197                                    ..default()
198                                },
199                                Label,
200                            ));
201                            // Scrolling list
202                            parent
203                                .spawn((
204                                    Node {
205                                        flex_direction: FlexDirection::Column,
206                                        align_self: AlignSelf::Stretch,
207                                        height: Val::Percent(50.),
208                                        overflow: Overflow::scroll(), // n.b.
209                                        ..default()
210                                    },
211                                    BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
212                                ))
213                                .with_children(|parent| {
214                                    // Rows in each column
215                                    for oi in 0..10 {
216                                        parent
217                                            .spawn(Node {
218                                                flex_direction: FlexDirection::Row,
219                                                ..default()
220                                            })
221                                            .insert(Pickable::IGNORE)
222                                            .with_children(|parent| {
223                                                // Elements in each row
224                                                for i in 0..25 {
225                                                    parent
226                                                        .spawn((
227                                                            Text(format!("Item {}", (oi * 25) + i)),
228                                                            TextFont {
229                                                                font: asset_server.load(
230                                                                    "fonts/FiraSans-Bold.ttf",
231                                                                ),
232                                                                ..default()
233                                                            },
234                                                            Label,
235                                                            AccessibilityNode(Accessible::new(
236                                                                Role::ListItem,
237                                                            )),
238                                                        ))
239                                                        .insert(Pickable {
240                                                            should_block_lower: false,
241                                                            ..default()
242                                                        });
243                                                }
244                                            });
245                                    }
246                                });
247                        });
248
249                    // Nested scrolls example
250                    parent
251                        .spawn(Node {
252                            flex_direction: FlexDirection::Column,
253                            justify_content: JustifyContent::Center,
254                            align_items: AlignItems::Center,
255                            width: Val::Px(200.),
256                            ..default()
257                        })
258                        .with_children(|parent| {
259                            // Title
260                            parent.spawn((
261                                Text::new("Nested Scrolling Lists"),
262                                TextFont {
263                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
264                                    font_size: FONT_SIZE,
265                                    ..default()
266                                },
267                                Label,
268                            ));
269                            // Outer, horizontal scrolling container
270                            parent
271                                .spawn((
272                                    Node {
273                                        column_gap: Val::Px(20.),
274                                        flex_direction: FlexDirection::Row,
275                                        align_self: AlignSelf::Stretch,
276                                        height: Val::Percent(50.),
277                                        overflow: Overflow::scroll_x(), // n.b.
278                                        ..default()
279                                    },
280                                    BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
281                                ))
282                                .with_children(|parent| {
283                                    // Inner, scrolling columns
284                                    for oi in 0..30 {
285                                        parent
286                                            .spawn((
287                                                Node {
288                                                    flex_direction: FlexDirection::Column,
289                                                    align_self: AlignSelf::Stretch,
290                                                    overflow: Overflow::scroll_y(),
291                                                    ..default()
292                                                },
293                                                BackgroundColor(Color::srgb(0.05, 0.05, 0.05)),
294                                            ))
295                                            .insert(Pickable {
296                                                should_block_lower: false,
297                                                ..default()
298                                            })
299                                            .with_children(|parent| {
300                                                for i in 0..25 {
301                                                    parent
302                                                        .spawn((
303                                                            Text(format!("Item {}", (oi * 25) + i)),
304                                                            TextFont {
305                                                                font: asset_server.load(
306                                                                    "fonts/FiraSans-Bold.ttf",
307                                                                ),
308                                                                ..default()
309                                                            },
310                                                            Label,
311                                                            AccessibilityNode(Accessible::new(
312                                                                Role::ListItem,
313                                                            )),
314                                                        ))
315                                                        .insert(Pickable {
316                                                            should_block_lower: false,
317                                                            ..default()
318                                                        });
319                                                }
320                                            });
321                                    }
322                                });
323                        });
324                });
325        });
326}
Source

pub const fn scroll_y() -> Overflow

Scroll overflowing items on the y axis

Examples found in repository?
examples/ui/scroll.rs (line 140)
25fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
26    // Camera
27    commands.spawn((Camera2d, IsDefaultUiCamera));
28
29    // root node
30    commands
31        .spawn(Node {
32            width: Val::Percent(100.0),
33            height: Val::Percent(100.0),
34            justify_content: JustifyContent::SpaceBetween,
35            flex_direction: FlexDirection::Column,
36            ..default()
37        })
38        .insert(Pickable::IGNORE)
39        .with_children(|parent| {
40            // horizontal scroll example
41            parent
42                .spawn(Node {
43                    width: Val::Percent(100.),
44                    flex_direction: FlexDirection::Column,
45                    ..default()
46                })
47                .with_children(|parent| {
48                    // header
49                    parent.spawn((
50                        Text::new("Horizontally Scrolling list (Ctrl + MouseWheel)"),
51                        TextFont {
52                            font: asset_server.load("fonts/FiraSans-Bold.ttf"),
53                            font_size: FONT_SIZE,
54                            ..default()
55                        },
56                        Label,
57                    ));
58
59                    // horizontal scroll container
60                    parent
61                        .spawn((
62                            Node {
63                                width: Val::Percent(80.),
64                                margin: UiRect::all(Val::Px(10.)),
65                                flex_direction: FlexDirection::Row,
66                                overflow: Overflow::scroll_x(), // n.b.
67                                ..default()
68                            },
69                            BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
70                        ))
71                        .with_children(|parent| {
72                            for i in 0..100 {
73                                parent.spawn((Text(format!("Item {i}")),
74                                        TextFont {
75                                            font: asset_server
76                                                .load("fonts/FiraSans-Bold.ttf"),
77                                            ..default()
78                                        },
79                                    Label,
80                                    AccessibilityNode(Accessible::new(Role::ListItem)),
81                                ))
82                                .insert(Node {
83                                    min_width: Val::Px(200.),
84                                    align_content: AlignContent::Center,
85                                    ..default()
86                                })
87                                .insert(Pickable {
88                                    should_block_lower: false,
89                                    ..default()
90                                })
91                                .observe(|
92                                    trigger: Trigger<Pointer<Pressed>>,
93                                    mut commands: Commands
94                                | {
95                                    if trigger.event().button == PointerButton::Primary {
96                                        commands.entity(trigger.target()).despawn();
97                                    }
98                                });
99                            }
100                        });
101                });
102
103            // container for all other examples
104            parent
105                .spawn(Node {
106                    width: Val::Percent(100.),
107                    height: Val::Percent(100.),
108                    flex_direction: FlexDirection::Row,
109                    justify_content: JustifyContent::SpaceBetween,
110                    ..default()
111                })
112                .with_children(|parent| {
113                    // vertical scroll example
114                    parent
115                        .spawn(Node {
116                            flex_direction: FlexDirection::Column,
117                            justify_content: JustifyContent::Center,
118                            align_items: AlignItems::Center,
119                            width: Val::Px(200.),
120                            ..default()
121                        })
122                        .with_children(|parent| {
123                            // Title
124                            parent.spawn((
125                                Text::new("Vertically Scrolling List"),
126                                TextFont {
127                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
128                                    font_size: FONT_SIZE,
129                                    ..default()
130                                },
131                                Label,
132                            ));
133                            // Scrolling list
134                            parent
135                                .spawn((
136                                    Node {
137                                        flex_direction: FlexDirection::Column,
138                                        align_self: AlignSelf::Stretch,
139                                        height: Val::Percent(50.),
140                                        overflow: Overflow::scroll_y(), // n.b.
141                                        ..default()
142                                    },
143                                    BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
144                                ))
145                                .with_children(|parent| {
146                                    // List items
147                                    for i in 0..25 {
148                                        parent
149                                            .spawn(Node {
150                                                min_height: Val::Px(LINE_HEIGHT),
151                                                max_height: Val::Px(LINE_HEIGHT),
152                                                ..default()
153                                            })
154                                            .insert(Pickable {
155                                                should_block_lower: false,
156                                                ..default()
157                                            })
158                                            .with_children(|parent| {
159                                                parent
160                                                    .spawn((
161                                                        Text(format!("Item {i}")),
162                                                        TextFont {
163                                                            font: asset_server
164                                                                .load("fonts/FiraSans-Bold.ttf"),
165                                                            ..default()
166                                                        },
167                                                        Label,
168                                                        AccessibilityNode(Accessible::new(
169                                                            Role::ListItem,
170                                                        )),
171                                                    ))
172                                                    .insert(Pickable {
173                                                        should_block_lower: false,
174                                                        ..default()
175                                                    });
176                                            });
177                                    }
178                                });
179                        });
180
181                    // Bidirectional scroll example
182                    parent
183                        .spawn(Node {
184                            flex_direction: FlexDirection::Column,
185                            justify_content: JustifyContent::Center,
186                            align_items: AlignItems::Center,
187                            width: Val::Px(200.),
188                            ..default()
189                        })
190                        .with_children(|parent| {
191                            // Title
192                            parent.spawn((
193                                Text::new("Bidirectionally Scrolling List"),
194                                TextFont {
195                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
196                                    font_size: FONT_SIZE,
197                                    ..default()
198                                },
199                                Label,
200                            ));
201                            // Scrolling list
202                            parent
203                                .spawn((
204                                    Node {
205                                        flex_direction: FlexDirection::Column,
206                                        align_self: AlignSelf::Stretch,
207                                        height: Val::Percent(50.),
208                                        overflow: Overflow::scroll(), // n.b.
209                                        ..default()
210                                    },
211                                    BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
212                                ))
213                                .with_children(|parent| {
214                                    // Rows in each column
215                                    for oi in 0..10 {
216                                        parent
217                                            .spawn(Node {
218                                                flex_direction: FlexDirection::Row,
219                                                ..default()
220                                            })
221                                            .insert(Pickable::IGNORE)
222                                            .with_children(|parent| {
223                                                // Elements in each row
224                                                for i in 0..25 {
225                                                    parent
226                                                        .spawn((
227                                                            Text(format!("Item {}", (oi * 25) + i)),
228                                                            TextFont {
229                                                                font: asset_server.load(
230                                                                    "fonts/FiraSans-Bold.ttf",
231                                                                ),
232                                                                ..default()
233                                                            },
234                                                            Label,
235                                                            AccessibilityNode(Accessible::new(
236                                                                Role::ListItem,
237                                                            )),
238                                                        ))
239                                                        .insert(Pickable {
240                                                            should_block_lower: false,
241                                                            ..default()
242                                                        });
243                                                }
244                                            });
245                                    }
246                                });
247                        });
248
249                    // Nested scrolls example
250                    parent
251                        .spawn(Node {
252                            flex_direction: FlexDirection::Column,
253                            justify_content: JustifyContent::Center,
254                            align_items: AlignItems::Center,
255                            width: Val::Px(200.),
256                            ..default()
257                        })
258                        .with_children(|parent| {
259                            // Title
260                            parent.spawn((
261                                Text::new("Nested Scrolling Lists"),
262                                TextFont {
263                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
264                                    font_size: FONT_SIZE,
265                                    ..default()
266                                },
267                                Label,
268                            ));
269                            // Outer, horizontal scrolling container
270                            parent
271                                .spawn((
272                                    Node {
273                                        column_gap: Val::Px(20.),
274                                        flex_direction: FlexDirection::Row,
275                                        align_self: AlignSelf::Stretch,
276                                        height: Val::Percent(50.),
277                                        overflow: Overflow::scroll_x(), // n.b.
278                                        ..default()
279                                    },
280                                    BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
281                                ))
282                                .with_children(|parent| {
283                                    // Inner, scrolling columns
284                                    for oi in 0..30 {
285                                        parent
286                                            .spawn((
287                                                Node {
288                                                    flex_direction: FlexDirection::Column,
289                                                    align_self: AlignSelf::Stretch,
290                                                    overflow: Overflow::scroll_y(),
291                                                    ..default()
292                                                },
293                                                BackgroundColor(Color::srgb(0.05, 0.05, 0.05)),
294                                            ))
295                                            .insert(Pickable {
296                                                should_block_lower: false,
297                                                ..default()
298                                            })
299                                            .with_children(|parent| {
300                                                for i in 0..25 {
301                                                    parent
302                                                        .spawn((
303                                                            Text(format!("Item {}", (oi * 25) + i)),
304                                                            TextFont {
305                                                                font: asset_server.load(
306                                                                    "fonts/FiraSans-Bold.ttf",
307                                                                ),
308                                                                ..default()
309                                                            },
310                                                            Label,
311                                                            AccessibilityNode(Accessible::new(
312                                                                Role::ListItem,
313                                                            )),
314                                                        ))
315                                                        .insert(Pickable {
316                                                            should_block_lower: false,
317                                                            ..default()
318                                                        });
319                                                }
320                                            });
321                                    }
322                                });
323                        });
324                });
325        });
326}
More examples
Hide additional examples
examples/testbed/full_ui.rs (line 159)
27fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
28    // Camera
29    commands.spawn((Camera2d, IsDefaultUiCamera, BoxShadowSamples(6)));
30
31    // root node
32    commands
33        .spawn(Node {
34            width: Val::Percent(100.0),
35            height: Val::Percent(100.0),
36            justify_content: JustifyContent::SpaceBetween,
37            ..default()
38        })
39        .insert(Pickable::IGNORE)
40        .with_children(|parent| {
41            // left vertical fill (border)
42            parent
43                .spawn((
44                    Node {
45                        width: Val::Px(200.),
46                        border: UiRect::all(Val::Px(2.)),
47                        ..default()
48                    },
49                    BackgroundColor(Color::srgb(0.65, 0.65, 0.65)),
50                ))
51                .with_children(|parent| {
52                    // left vertical fill (content)
53                    parent
54                        .spawn((
55                            Node {
56                                width: Val::Percent(100.),
57                                flex_direction: FlexDirection::Column,
58                                padding: UiRect::all(Val::Px(5.)),
59                                row_gap: Val::Px(5.),
60                                ..default()
61                            },
62                            BackgroundColor(Color::srgb(0.15, 0.15, 0.15)),
63                            Visibility::Visible,
64                        ))
65                        .with_children(|parent| {
66                            // text
67                            parent.spawn((
68                                Text::new("Text Example"),
69                                TextFont {
70                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
71                                    font_size: 25.0,
72                                    ..default()
73                                },
74                                // Because this is a distinct label widget and
75                                // not button/list item text, this is necessary
76                                // for accessibility to treat the text accordingly.
77                                Label,
78                            ));
79
80                            #[cfg(feature = "bevy_ui_debug")]
81                            {
82                                // Debug overlay text
83                                parent.spawn((
84                                    Text::new("Press Space to toggle debug outlines."),
85                                    TextFont {
86                                        font: asset_server.load("fonts/FiraSans-Bold.ttf"),
87                                        ..default()
88                                    },
89                                    Label,
90                                ));
91
92                                parent.spawn((
93                                    Text::new("V: toggle UI root's visibility"),
94                                    TextFont {
95                                        font: asset_server.load("fonts/FiraSans-Bold.ttf"),
96                                        font_size: 12.,
97                                        ..default()
98                                    },
99                                    Label,
100                                ));
101
102                                parent.spawn((
103                                    Text::new("S: toggle outlines for hidden nodes"),
104                                    TextFont {
105                                        font: asset_server.load("fonts/FiraSans-Bold.ttf"),
106                                        font_size: 12.,
107                                        ..default()
108                                    },
109                                    Label,
110                                ));
111                                parent.spawn((
112                                    Text::new("C: toggle outlines for clipped nodes"),
113                                    TextFont {
114                                        font: asset_server.load("fonts/FiraSans-Bold.ttf"),
115                                        font_size: 12.,
116                                        ..default()
117                                    },
118                                    Label,
119                                ));
120                            }
121                            #[cfg(not(feature = "bevy_ui_debug"))]
122                            parent.spawn((
123                                Text::new("Try enabling feature \"bevy_ui_debug\"."),
124                                TextFont {
125                                    font: asset_server.load("fonts/FiraSans-Bold.ttf"),
126                                    ..default()
127                                },
128                                Label,
129                            ));
130                        });
131                });
132            // right vertical fill
133            parent
134                .spawn(Node {
135                    flex_direction: FlexDirection::Column,
136                    justify_content: JustifyContent::Center,
137                    align_items: AlignItems::Center,
138                    width: Val::Px(200.),
139                    ..default()
140                })
141                .with_children(|parent| {
142                    // Title
143                    parent.spawn((
144                        Text::new("Scrolling list"),
145                        TextFont {
146                            font: asset_server.load("fonts/FiraSans-Bold.ttf"),
147                            font_size: 21.,
148                            ..default()
149                        },
150                        Label,
151                    ));
152                    // Scrolling list
153                    parent
154                        .spawn((
155                            Node {
156                                flex_direction: FlexDirection::Column,
157                                align_self: AlignSelf::Stretch,
158                                height: Val::Percent(50.),
159                                overflow: Overflow::scroll_y(),
160                                ..default()
161                            },
162                            BackgroundColor(Color::srgb(0.10, 0.10, 0.10)),
163                        ))
164                        .with_children(|parent| {
165                            // List items
166                            for i in 0..25 {
167                                parent
168                                    .spawn((
169                                        Text(format!("Item {i}")),
170                                        TextFont {
171                                            font: asset_server.load("fonts/FiraSans-Bold.ttf"),
172                                            ..default()
173                                        },
174                                        Label,
175                                        AccessibilityNode(Accessible::new(Role::ListItem)),
176                                    ))
177                                    .insert(Pickable {
178                                        should_block_lower: false,
179                                        ..default()
180                                    });
181                            }
182                        });
183                });
184
185            parent
186                .spawn(Node {
187                    left: Val::Px(210.),
188                    bottom: Val::Px(10.),
189                    position_type: PositionType::Absolute,
190                    ..default()
191                })
192                .with_children(|parent| {
193                    parent
194                        .spawn((
195                            Node {
196                                width: Val::Px(200.0),
197                                height: Val::Px(200.0),
198                                border: UiRect::all(Val::Px(20.)),
199                                flex_direction: FlexDirection::Column,
200                                justify_content: JustifyContent::Center,
201                                ..default()
202                            },
203                            BorderColor(LIME.into()),
204                            BackgroundColor(Color::srgb(0.8, 0.8, 1.)),
205                        ))
206                        .with_children(|parent| {
207                            parent.spawn((
208                                ImageNode::new(asset_server.load("branding/bevy_logo_light.png")),
209                                // Uses the transform to rotate the logo image by 45 degrees
210                                Transform::from_rotation(Quat::from_rotation_z(0.25 * PI)),
211                                BorderRadius::all(Val::Px(10.)),
212                                Outline {
213                                    width: Val::Px(2.),
214                                    offset: Val::Px(4.),
215                                    color: DARK_GRAY.into(),
216                                },
217                            ));
218                        });
219                });
220
221            let shadow_style = ShadowStyle {
222                color: Color::BLACK.with_alpha(0.5),
223                blur_radius: Val::Px(2.),
224                x_offset: Val::Px(10.),
225                y_offset: Val::Px(10.),
226                ..default()
227            };
228
229            // render order test: reddest in the back, whitest in the front (flex center)
230            parent
231                .spawn(Node {
232                    width: Val::Percent(100.0),
233                    height: Val::Percent(100.0),
234                    position_type: PositionType::Absolute,
235                    align_items: AlignItems::Center,
236                    justify_content: JustifyContent::Center,
237                    ..default()
238                })
239                .insert(Pickable::IGNORE)
240                .with_children(|parent| {
241                    parent
242                        .spawn((
243                            Node {
244                                width: Val::Px(100.0),
245                                height: Val::Px(100.0),
246                                ..default()
247                            },
248                            BackgroundColor(Color::srgb(1.0, 0.0, 0.)),
249                            BoxShadow::from(shadow_style),
250                        ))
251                        .with_children(|parent| {
252                            parent.spawn((
253                                Node {
254                                    // Take the size of the parent node.
255                                    width: Val::Percent(100.0),
256                                    height: Val::Percent(100.0),
257                                    position_type: PositionType::Absolute,
258                                    left: Val::Px(20.),
259                                    bottom: Val::Px(20.),
260                                    ..default()
261                                },
262                                BackgroundColor(Color::srgb(1.0, 0.3, 0.3)),
263                                BoxShadow::from(shadow_style),
264                            ));
265                            parent.spawn((
266                                Node {
267                                    width: Val::Percent(100.0),
268                                    height: Val::Percent(100.0),
269                                    position_type: PositionType::Absolute,
270                                    left: Val::Px(40.),
271                                    bottom: Val::Px(40.),
272                                    ..default()
273                                },
274                                BackgroundColor(Color::srgb(1.0, 0.5, 0.5)),
275                                BoxShadow::from(shadow_style),
276                            ));
277                            parent.spawn((
278                                Node {
279                                    width: Val::Percent(100.0),
280                                    height: Val::Percent(100.0),
281                                    position_type: PositionType::Absolute,
282                                    left: Val::Px(60.),
283                                    bottom: Val::Px(60.),
284                                    ..default()
285                                },
286                                BackgroundColor(Color::srgb(0.0, 0.7, 0.7)),
287                                BoxShadow::from(shadow_style),
288                            ));
289                            // alpha test
290                            parent.spawn((
291                                Node {
292                                    width: Val::Percent(100.0),
293                                    height: Val::Percent(100.0),
294                                    position_type: PositionType::Absolute,
295                                    left: Val::Px(80.),
296                                    bottom: Val::Px(80.),
297                                    ..default()
298                                },
299                                BackgroundColor(Color::srgba(1.0, 0.9, 0.9, 0.4)),
300                                BoxShadow::from(ShadowStyle {
301                                    color: Color::BLACK.with_alpha(0.3),
302                                    ..shadow_style
303                                }),
304                            ));
305                        });
306                });
307            // bevy logo (flex center)
308            parent
309                .spawn(Node {
310                    width: Val::Percent(100.0),
311                    position_type: PositionType::Absolute,
312                    justify_content: JustifyContent::Center,
313                    align_items: AlignItems::FlexStart,
314                    ..default()
315                })
316                .with_children(|parent| {
317                    // bevy logo (image)
318                    parent
319                        .spawn((
320                            ImageNode::new(asset_server.load("branding/bevy_logo_dark_big.png"))
321                                .with_mode(NodeImageMode::Stretch),
322                            Node {
323                                width: Val::Px(500.0),
324                                height: Val::Px(125.0),
325                                margin: UiRect::top(Val::VMin(5.)),
326                                ..default()
327                            },
328                        ))
329                        .with_children(|parent| {
330                            // alt text
331                            // This UI node takes up no space in the layout and the `Text` component is used by the accessibility module
332                            // and is not rendered.
333                            parent.spawn((
334                                Node {
335                                    display: Display::None,
336                                    ..default()
337                                },
338                                Text::new("Bevy logo"),
339                            ));
340                        });
341                });
342
343            // four bevy icons demonstrating image flipping
344            parent
345                .spawn(Node {
346                    width: Val::Percent(100.0),
347                    height: Val::Percent(100.0),
348                    position_type: PositionType::Absolute,
349                    justify_content: JustifyContent::Center,
350                    align_items: AlignItems::FlexEnd,
351                    column_gap: Val::Px(10.),
352                    padding: UiRect::all(Val::Px(10.)),
353                    ..default()
354                })
355                .insert(Pickable::IGNORE)
356                .with_children(|parent| {
357                    for (flip_x, flip_y) in
358                        [(false, false), (false, true), (true, true), (true, false)]
359                    {
360                        parent.spawn((
361                            ImageNode {
362                                image: asset_server.load("branding/icon.png"),
363                                flip_x,
364                                flip_y,
365                                ..default()
366                            },
367                            Node {
368                                // The height will be chosen automatically to preserve the image's aspect ratio
369                                width: Val::Px(75.),
370                                ..default()
371                            },
372                        ));
373                    }
374                });
375        });
376}

Trait Implementations§

Source§

impl Clone for Overflow

Source§

fn clone(&self) -> Overflow

Returns a copy 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 Debug for Overflow

Source§

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

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

impl Default for Overflow

Source§

fn default() -> Overflow

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

impl<'de> Deserialize<'de> for Overflow

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Overflow, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FromArg for &'static Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

type This<'from_arg> = &'from_arg Overflow

The type to convert into. Read more
Source§

fn from_arg( arg: Arg<'_>, ) -> Result<<&'static Overflow as FromArg>::This<'_>, ArgError>

Creates an item from an argument. Read more
Source§

impl FromArg for &'static mut Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

type This<'from_arg> = &'from_arg mut Overflow

The type to convert into. Read more
Source§

fn from_arg( arg: Arg<'_>, ) -> Result<<&'static mut Overflow as FromArg>::This<'_>, ArgError>

Creates an item from an argument. Read more
Source§

impl FromArg for Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

type This<'from_arg> = Overflow

The type to convert into. Read more
Source§

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

Creates an item from an argument. Read more
Source§

impl FromReflect for Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Overflow>

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 GetOwnership for &Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn ownership() -> Ownership

Returns the ownership of Self.
Source§

impl GetOwnership for &mut Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn ownership() -> Ownership

Returns the ownership of Self.
Source§

impl GetOwnership for Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn ownership() -> Ownership

Returns the ownership of Self.
Source§

impl GetTypeRegistration for Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

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 IntoReturn for &Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn into_return<'into_return>(self) -> Return<'into_return>
where &Overflow: 'into_return,

Converts Self into a Return value.
Source§

impl IntoReturn for &mut Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn into_return<'into_return>(self) -> Return<'into_return>
where &mut Overflow: 'into_return,

Converts Self into a Return value.
Source§

impl IntoReturn for Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

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

Converts Self into a Return value.
Source§

impl PartialEq for Overflow

Source§

fn eq(&self, other: &Overflow) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialReflect for Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

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: &(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<Overflow>) -> ReflectOwned

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

fn try_into_reflect( self: Box<Overflow>, ) -> 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<Overflow>) -> 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_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>

Returns a “partial equality” comparison result. 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 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 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_hash(&self) -> Option<u64>

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

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

Debug formatter for the value. Read more
Source§

fn is_dynamic(&self) -> bool

Indicates whether or not this type is a dynamic type. Read more
Source§

impl Reflect for Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn into_any(self: Box<Overflow>) -> 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<Overflow>) -> 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 Serialize for Overflow

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Struct for Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>

Returns a reference to the value of the field named name as a &dyn PartialReflect.
Source§

fn field_mut( &mut self, name: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>

Returns a mutable reference to the value of the field named name as a &mut dyn PartialReflect.
Source§

fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>

Returns a reference to the value of the field with index index as a &dyn PartialReflect.
Source§

fn field_at_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>

Returns a mutable reference to the value of the field with index index as a &mut dyn PartialReflect.
Source§

fn name_at(&self, index: usize) -> Option<&str>

Returns the name of the field with index index.
Source§

fn field_len(&self) -> usize

Returns the number of fields in the struct.
Source§

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

Returns an iterator over the values of the reflectable fields for this struct.
Source§

fn to_dynamic_struct(&self) -> DynamicStruct

Source§

fn clone_dynamic(&self) -> DynamicStruct

👎Deprecated since 0.16.0: use to_dynamic_struct instead
Clones the struct into a DynamicStruct.
Source§

fn get_represented_struct_info(&self) -> Option<&'static StructInfo>

Will return None if TypeInfo is not available.
Source§

impl TypePath for Overflow
where Overflow: Any + Send + Sync,

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 Typed for Overflow
where Overflow: Any + Send + Sync, OverflowAxis: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn type_info() -> &'static TypeInfo

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

impl Copy for Overflow

Source§

impl Eq for Overflow

Source§

impl StructuralPartialEq for Overflow

Auto Trait Implementations§

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

Source§

fn downcast(&self) -> &T

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> DynEq for T
where T: Any + Eq,

Source§

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

Casts the type to dyn Any.
Source§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
Source§

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

Source§

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

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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<S> GetField for S
where S: Struct,

Source§

fn get_field<T>(&self, name: &str) -> Option<&T>
where T: Reflect,

Returns a reference to the value of the field named name, downcast to T.
Source§

fn get_field_mut<T>(&mut self, name: &str) -> Option<&mut T>
where T: Reflect,

Returns a mutable reference to the value of the field named name, downcast to T.
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> 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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

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

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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,