pub struct BorderRect {
pub min_inset: Vec2,
pub max_inset: Vec2,
}Expand description
Defines border insets that shrink a rectangle from its minimum and maximum corners.
This struct is used to represent thickness or offsets from the four edges of a rectangle, with values increasing inwards.
Fields§
§min_inset: Vec2Inset applied to the rectangle’s minimum corner
max_inset: Vec2Inset applied to the rectangle’s maximum corner
Implementations§
Source§impl BorderRect
impl BorderRect
Sourcepub const ZERO: BorderRect
pub const ZERO: BorderRect
An empty border with zero thickness along each edge
Sourcepub const fn all(inset: f32) -> BorderRect
pub const fn all(inset: f32) -> BorderRect
Creates a border with the same inset along each edge
Examples found in repository?
examples/testbed/2d.rs (line 352)
333 pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
334 commands.spawn((Camera2d, DespawnOnExit(super::Scene::SpriteSlicing)));
335
336 let texture = asset_server.load("textures/slice_square_2.png");
337 let font = asset_server.load("fonts/FiraSans-Bold.ttf");
338
339 commands.spawn((
340 Sprite {
341 image: texture.clone(),
342 ..default()
343 },
344 Transform::from_translation(Vec3::new(-150.0, 50.0, 0.0)).with_scale(Vec3::splat(2.0)),
345 DespawnOnExit(super::Scene::SpriteSlicing),
346 ));
347
348 commands.spawn((
349 Sprite {
350 image: texture,
351 image_mode: SpriteImageMode::Sliced(TextureSlicer {
352 border: BorderRect::all(20.0),
353 center_scale_mode: SliceScaleMode::Stretch,
354 ..default()
355 }),
356 custom_size: Some(Vec2::new(200.0, 200.0)),
357 ..default()
358 },
359 Transform::from_translation(Vec3::new(150.0, 50.0, 0.0)),
360 DespawnOnExit(super::Scene::SpriteSlicing),
361 ));
362
363 commands.spawn((
364 Text2d::new("Original"),
365 TextFont {
366 font: FontSource::from(font.clone()),
367 font_size: FontSize::Px(20.0),
368 ..default()
369 },
370 Transform::from_translation(Vec3::new(-150.0, -80.0, 0.0)),
371 DespawnOnExit(super::Scene::SpriteSlicing),
372 ));
373
374 commands.spawn((
375 Text2d::new("Sliced"),
376 TextFont {
377 font: FontSource::from(font.clone()),
378 font_size: FontSize::Px(20.0),
379 ..default()
380 },
381 Transform::from_translation(Vec3::new(150.0, -80.0, 0.0)),
382 DespawnOnExit(super::Scene::SpriteSlicing),
383 ));
384 }More examples
examples/ui/images/ui_texture_slice.rs (line 48)
44fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
45 let image = asset_server.load("textures/fantasy_ui_borders/panel-border-010.png");
46
47 let slicer = TextureSlicer {
48 border: BorderRect::all(22.0),
49 center_scale_mode: SliceScaleMode::Stretch,
50 sides_scale_mode: SliceScaleMode::Stretch,
51 max_corner_scale: 1.0,
52 };
53 // ui camera
54 commands.spawn(Camera2d);
55 commands
56 .spawn(Node {
57 width: percent(100),
58 height: percent(100),
59 align_items: AlignItems::Center,
60 justify_content: JustifyContent::Center,
61 ..default()
62 })
63 .with_children(|parent| {
64 for [w, h] in [[150.0, 150.0], [300.0, 150.0], [150.0, 300.0]] {
65 parent
66 .spawn((
67 Button,
68 ImageNode {
69 image: image.clone(),
70 image_mode: NodeImageMode::Sliced(slicer.clone()),
71 ..default()
72 },
73 Node {
74 width: px(w),
75 height: px(h),
76 // horizontally center child text
77 justify_content: JustifyContent::Center,
78 // vertically center child text
79 align_items: AlignItems::Center,
80 margin: UiRect::all(px(20)),
81 ..default()
82 },
83 ))
84 .with_child((
85 Text::new("Button"),
86 TextFont {
87 font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
88 font_size: FontSize::Px(33.0),
89 ..default()
90 },
91 TextColor(Color::srgb(0.9, 0.9, 0.9)),
92 ));
93 }
94 });
95}examples/ui/images/ui_texture_slice_flip_and_tile.rs (line 28)
17fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
18 let image = asset_server
19 .load_builder()
20 .with_settings(|settings: &mut ImageLoaderSettings| {
21 // Need to use nearest filtering to avoid bleeding between the slices with tiling
22 settings.sampler = ImageSampler::nearest();
23 })
24 .load("textures/fantasy_ui_borders/numbered_slices.png");
25
26 let slicer = TextureSlicer {
27 // `numbered_slices.png` is 48 pixels square. `BorderRect::square(16.)` insets the slicing line from each edge by 16 pixels, resulting in nine slices that are each 16 pixels square.
28 border: BorderRect::all(16.),
29 // With `SliceScaleMode::Tile` the side and center slices are tiled to fill the side and center sections of the target.
30 // And with a `stretch_value` of `1.` the tiles will have the same size as the corresponding slices in the source image.
31 center_scale_mode: SliceScaleMode::Tile { stretch_value: 1. },
32 sides_scale_mode: SliceScaleMode::Tile { stretch_value: 1. },
33 ..default()
34 };
35
36 // ui camera
37 commands.spawn(Camera2d);
38
39 commands
40 .spawn(Node {
41 width: percent(100),
42 height: percent(100),
43 justify_content: JustifyContent::Center,
44 align_content: AlignContent::Center,
45 flex_wrap: FlexWrap::Wrap,
46 column_gap: px(10),
47 row_gap: px(10),
48 ..default()
49 })
50 .with_children(|parent| {
51 for [columns, rows] in [[3, 3], [4, 4], [5, 4], [4, 5], [5, 5]] {
52 for (flip_x, flip_y) in [(false, false), (false, true), (true, false), (true, true)]
53 {
54 parent.spawn((
55 ImageNode {
56 image: image.clone(),
57 flip_x,
58 flip_y,
59 image_mode: NodeImageMode::Sliced(slicer.clone()),
60 ..default()
61 },
62 Node {
63 width: px(16 * columns),
64 height: px(16 * rows),
65 ..default()
66 },
67 ));
68 }
69 }
70 });
71}examples/ui/images/ui_texture_atlas_slice.rs (line 58)
47fn setup(
48 mut commands: Commands,
49 asset_server: Res<AssetServer>,
50 mut texture_atlases: ResMut<Assets<TextureAtlasLayout>>,
51) {
52 let texture_handle = asset_server.load("textures/fantasy_ui_borders/border_sheet.png");
53 let atlas_layout =
54 TextureAtlasLayout::from_grid(UVec2::new(50, 50), 6, 6, Some(UVec2::splat(2)), None);
55 let atlas_layout_handle = texture_atlases.add(atlas_layout);
56
57 let slicer = TextureSlicer {
58 border: BorderRect::all(24.0),
59 center_scale_mode: SliceScaleMode::Stretch,
60 sides_scale_mode: SliceScaleMode::Stretch,
61 max_corner_scale: 1.0,
62 };
63 // ui camera
64 commands.spawn(Camera2d);
65 commands
66 .spawn(Node {
67 width: percent(100),
68 height: percent(100),
69 align_items: AlignItems::Center,
70 justify_content: JustifyContent::Center,
71 ..default()
72 })
73 .with_children(|parent| {
74 for (idx, [w, h]) in [
75 (0, [150.0, 150.0]),
76 (7, [300.0, 150.0]),
77 (13, [150.0, 300.0]),
78 ] {
79 parent
80 .spawn((
81 Button,
82 ImageNode::from_atlas_image(
83 texture_handle.clone(),
84 TextureAtlas {
85 index: idx,
86 layout: atlas_layout_handle.clone(),
87 },
88 )
89 .with_mode(NodeImageMode::Sliced(slicer.clone())),
90 Node {
91 width: px(w),
92 height: px(h),
93 // horizontally center child text
94 justify_content: JustifyContent::Center,
95 // vertically center child text
96 align_items: AlignItems::Center,
97 margin: px(20).all(),
98 ..default()
99 },
100 ))
101 .with_children(|parent| {
102 parent.spawn((
103 Text::new("Button"),
104 TextFont {
105 font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
106 font_size: FontSize::Px(33.0),
107 ..default()
108 },
109 TextColor(Color::srgb(0.9, 0.9, 0.9)),
110 ));
111 });
112 }
113 });
114}examples/2d/sprite_slice.rs (line 41)
12fn spawn_sprites(
13 commands: &mut Commands,
14 texture_handle: Handle<Image>,
15 mut position: Vec3,
16 slice_border: f32,
17 style: TextFont,
18 gap: f32,
19) {
20 let cases = [
21 // Reference sprite
22 (
23 "Original",
24 style.clone(),
25 Vec2::splat(100.0),
26 SpriteImageMode::Auto,
27 ),
28 // Scaled regular sprite
29 (
30 "Stretched",
31 style.clone(),
32 Vec2::new(100.0, 200.0),
33 SpriteImageMode::Auto,
34 ),
35 // Stretched Scaled sliced sprite
36 (
37 "With Slicing",
38 style.clone(),
39 Vec2::new(100.0, 200.0),
40 SpriteImageMode::Sliced(TextureSlicer {
41 border: BorderRect::all(slice_border),
42 center_scale_mode: SliceScaleMode::Stretch,
43 ..default()
44 }),
45 ),
46 // Scaled sliced sprite
47 (
48 "With Tiling",
49 style.clone(),
50 Vec2::new(100.0, 200.0),
51 SpriteImageMode::Sliced(TextureSlicer {
52 border: BorderRect::all(slice_border),
53 center_scale_mode: SliceScaleMode::Tile { stretch_value: 0.5 },
54 sides_scale_mode: SliceScaleMode::Tile { stretch_value: 0.2 },
55 ..default()
56 }),
57 ),
58 // Scaled sliced sprite horizontally
59 (
60 "With Tiling",
61 style.clone(),
62 Vec2::new(300.0, 200.0),
63 SpriteImageMode::Sliced(TextureSlicer {
64 border: BorderRect::all(slice_border),
65 center_scale_mode: SliceScaleMode::Tile { stretch_value: 0.2 },
66 sides_scale_mode: SliceScaleMode::Tile { stretch_value: 0.3 },
67 ..default()
68 }),
69 ),
70 // Scaled sliced sprite horizontally with max scale
71 (
72 "With Corners Constrained",
73 style,
74 Vec2::new(300.0, 200.0),
75 SpriteImageMode::Sliced(TextureSlicer {
76 border: BorderRect::all(slice_border),
77 center_scale_mode: SliceScaleMode::Tile { stretch_value: 0.1 },
78 sides_scale_mode: SliceScaleMode::Tile { stretch_value: 0.2 },
79 max_corner_scale: 0.2,
80 }),
81 ),
82 ];
83
84 for (label, text_style, size, scale_mode) in cases {
85 position.x += 0.5 * size.x;
86 commands.spawn((
87 Sprite {
88 image: texture_handle.clone(),
89 custom_size: Some(size),
90 image_mode: scale_mode,
91 ..default()
92 },
93 Transform::from_translation(position),
94 children![(
95 Text2d::new(label),
96 text_style,
97 TextLayout::justify(Justify::Center),
98 Transform::from_xyz(0., -0.5 * size.y - 10., 0.0),
99 bevy::sprite::Anchor::TOP_CENTER,
100 )],
101 ));
102 position.x += 0.5 * size.x + gap;
103 }
104}examples/testbed/ui.rs (line 1031)
1026 pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
1027 commands.spawn((Camera2d, DespawnOnExit(super::Scene::Slice)));
1028 let image = asset_server.load("textures/fantasy_ui_borders/numbered_slices.png");
1029
1030 let slicer = TextureSlicer {
1031 border: BorderRect::all(16.0),
1032 center_scale_mode: SliceScaleMode::Tile { stretch_value: 1.0 },
1033 sides_scale_mode: SliceScaleMode::Tile { stretch_value: 1.0 },
1034 ..default()
1035 };
1036 commands
1037 .spawn((
1038 Node {
1039 width: percent(100),
1040 height: percent(100),
1041 flex_direction: FlexDirection::Column,
1042 justify_content: JustifyContent::SpaceAround,
1043 align_content: AlignContent::Center,
1044 ..default()
1045 },
1046 DespawnOnExit(super::Scene::Slice),
1047 ))
1048 .with_children(|parent| {
1049 for visual_box in [
1050 VisualBox::BorderBox,
1051 VisualBox::PaddingBox,
1052 VisualBox::ContentBox,
1053 ] {
1054 parent
1055 .spawn(Node {
1056 justify_content: JustifyContent::SpaceAround,
1057 ..default()
1058 })
1059 .with_children(|parent| {
1060 for [w, h] in [[200.0, 200.0], [300.0, 200.0], [150., 200.0]] {
1061 parent.spawn((
1062 Button,
1063 ImageNode {
1064 image: image.clone(),
1065 image_mode: NodeImageMode::Sliced(slicer.clone()),
1066 visual_box,
1067 ..default()
1068 },
1069 Node {
1070 width: px(w),
1071 height: px(h),
1072 border: px(20.).all(),
1073 padding: px(20.).all(),
1074 ..default()
1075 },
1076 Outline {
1077 width: px(2.),
1078 ..default()
1079 },
1080 ));
1081 }
1082
1083 parent.spawn((
1084 ImageNode {
1085 image: asset_server
1086 .load("textures/fantasy_ui_borders/panel-border-010.png"),
1087 image_mode: NodeImageMode::Sliced(TextureSlicer {
1088 border: BorderRect::all(22.0),
1089 center_scale_mode: SliceScaleMode::Stretch,
1090 sides_scale_mode: SliceScaleMode::Stretch,
1091 max_corner_scale: 1.0,
1092 }),
1093 visual_box,
1094 ..Default::default()
1095 },
1096 Node {
1097 width: px(200),
1098 height: px(200),
1099 border: px(20.).all(),
1100 padding: px(20.).all(),
1101 ..default()
1102 },
1103 Outline {
1104 color: bevy::color::palettes::css::DARK_CYAN.into(),
1105 width: px(2.),
1106 ..default()
1107 },
1108 BackgroundColor(bevy::color::palettes::css::NAVY.into()),
1109 ));
1110 });
1111 }
1112 });
1113 }Sourcepub const fn axes(horizontal: f32, vertical: f32) -> BorderRect
pub const fn axes(horizontal: f32, vertical: f32) -> BorderRect
Creates a new border with the min.x and max.x insets equal to horizontal, and the min.y and max.y insets equal to vertical.
Trait Implementations§
Source§impl Add for BorderRect
impl Add for BorderRect
Source§type Output = BorderRect
type Output = BorderRect
The resulting type after applying the
+ operator.Source§fn add(self, rhs: BorderRect) -> <BorderRect as Add>::Output
fn add(self, rhs: BorderRect) -> <BorderRect as Add>::Output
Performs the
+ operation. Read moreSource§impl Clone for BorderRect
impl Clone for BorderRect
Source§fn clone(&self) -> BorderRect
fn clone(&self) -> BorderRect
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BorderRect
Source§impl Debug for BorderRect
impl Debug for BorderRect
Source§impl Default for BorderRect
impl Default for BorderRect
Source§fn default() -> BorderRect
fn default() -> BorderRect
Returns the “default value” for a type. Read more
Source§impl Div<f32> for BorderRect
impl Div<f32> for BorderRect
Source§impl From<f32> for BorderRect
impl From<f32> for BorderRect
Source§fn from(inset: f32) -> BorderRect
fn from(inset: f32) -> BorderRect
Converts to this type from the input type.
Source§impl FromArg for BorderRect
impl FromArg for BorderRect
Source§impl FromReflect for BorderRect
impl FromReflect for BorderRect
Source§fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<BorderRect>
fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<BorderRect>
Constructs a concrete instance of
Self from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn PartialReflect>,
) -> Result<Self, Box<dyn PartialReflect>>
fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>
Attempts to downcast the given value to
Self using,
constructing the value using from_reflect if that fails. Read moreSource§impl GetOwnership for BorderRect
impl GetOwnership for BorderRect
Source§impl GetTypeRegistration for BorderRect
impl GetTypeRegistration for BorderRect
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
Returns the default
TypeRegistration for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Registers other types needed by this type. Read more
Source§impl IntoReturn for BorderRect
impl IntoReturn for BorderRect
Source§fn into_return<'into_return>(self) -> Return<'into_return>where
BorderRect: 'into_return,
fn into_return<'into_return>(self) -> Return<'into_return>where
BorderRect: 'into_return,
Source§impl Mul<f32> for BorderRect
impl Mul<f32> for BorderRect
Source§impl PartialEq for BorderRect
impl PartialEq for BorderRect
Source§fn eq(&self, other: &BorderRect) -> bool
fn eq(&self, other: &BorderRect) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialReflect for BorderRect
impl PartialReflect for BorderRect
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn try_apply(
&mut self,
value: &(dyn PartialReflect + 'static),
) -> Result<(), ApplyError>
fn try_apply( &mut self, value: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Returns a zero-sized enumeration of “kinds” of type. Read more
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Returns an immutable enumeration of “kinds” of type. Read more
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Returns a mutable enumeration of “kinds” of type. Read more
Source§fn reflect_owned(self: Box<BorderRect>) -> ReflectOwned
fn reflect_owned(self: Box<BorderRect>) -> ReflectOwned
Returns an owned enumeration of “kinds” of type. Read more
Source§fn try_into_reflect(
self: Box<BorderRect>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<BorderRect>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
Attempts to cast this type to a boxed, fully-reflected value.
Source§fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
Attempts to cast this type to a fully-reflected value.
Source§fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
Attempts to cast this type to a mutable, fully-reflected value.
Source§fn into_partial_reflect(self: Box<BorderRect>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<BorderRect>) -> Box<dyn PartialReflect>
Casts this type to a boxed, reflected value. Read more
Source§fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
Casts this type to a reflected value. Read more
Source§fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
Casts this type to a mutable, reflected value. Read more
Source§fn reflect_partial_eq(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<bool>
fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>
Returns a “partial equality” comparison result. Read more
Source§fn reflect_partial_cmp(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<Ordering>
fn reflect_partial_cmp( &self, value: &(dyn PartialReflect + 'static), ) -> Option<Ordering>
Returns a “partial comparison” result. Read more
Source§fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
Attempts to clone
Self using reflection. Read moreSource§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Applies a reflected value to this value. Read more
Source§fn to_dynamic(&self) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
Source§fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
For a type implementing
PartialReflect, combines reflect_clone and
take in a useful fashion, automatically constructing an appropriate
ReflectCloneError if the downcast fails.Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Returns a hash of the value (which includes the type). Read more
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Debug formatter for the value. Read more
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Indicates whether or not this type is a dynamic type. Read more
Source§impl Reflect for BorderRect
impl Reflect for BorderRect
Source§fn into_any(self: Box<BorderRect>) -> Box<dyn Any>
fn into_any(self: Box<BorderRect>) -> Box<dyn Any>
Returns the value as a
Box<dyn Any>. Read moreSource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Returns the value as a
&mut dyn Any. Read moreSource§fn into_reflect(self: Box<BorderRect>) -> Box<dyn Reflect>
fn into_reflect(self: Box<BorderRect>) -> Box<dyn Reflect>
Casts this type to a boxed, fully-reflected value.
Source§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
Casts this type to a fully-reflected value.
Source§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
Casts this type to a mutable, fully-reflected value.
Source§impl Struct for BorderRect
impl Struct for BorderRect
Source§fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
Gets 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)>
fn field_mut( &mut self, name: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>
Gets 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)>
fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
Gets 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)>
fn field_at_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>
Gets a mutable reference to the value of the field with index
index
as a &mut dyn PartialReflect.Source§fn index_of_name(&self, name: &str) -> Option<usize>
fn index_of_name(&self, name: &str) -> Option<usize>
Gets the index of the field with the given name.
Source§fn iter_fields(&self) -> FieldIter<'_> ⓘ
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
fn to_dynamic_struct(&self) -> DynamicStruct
Creates a new
DynamicStruct from this struct.Source§fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
Will return
None if TypeInfo is not available.impl StructuralPartialEq for BorderRect
Source§impl Sub for BorderRect
impl Sub for BorderRect
Source§type Output = BorderRect
type Output = BorderRect
The resulting type after applying the
- operator.Source§fn sub(self, rhs: BorderRect) -> <BorderRect as Sub>::Output
fn sub(self, rhs: BorderRect) -> <BorderRect as Sub>::Output
Performs the
- operation. Read moreSource§impl TypePath for BorderRect
impl TypePath for BorderRect
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Returns the fully qualified path of the underlying type. Read more
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Returns a short, pretty-print enabled path to the type. Read more
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Auto Trait Implementations§
impl Freeze for BorderRect
impl RefUnwindSafe for BorderRect
impl Send for BorderRect
impl Sync for BorderRect
impl Unpin for BorderRect
impl UnsafeUnpin for BorderRect
impl UnwindSafe for BorderRect
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
Return the
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
See
TypePath::type_path.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
See
TypePath::type_ident.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
See
TypePath::crate_name.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<T> DynamicTyped for Twhere
T: Typed,
impl<T> DynamicTyped for Twhere
T: Typed,
Source§fn reflect_type_info(&self) -> &'static TypeInfo
fn reflect_type_info(&self) -> &'static TypeInfo
See
Typed::type_info.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromTemplate for T
impl<T> FromTemplate for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
Source§impl<T> GetPath for T
impl<T> GetPath for T
Source§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
Returns a reference to the value specified by
path. Read moreSource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
Returns a mutable reference to the value specified by
path. Read moreSource§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
Returns a statically typed reference to the value specified by
path. Read moreSource§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
Returns a statically typed mutable reference to the value specified by
path. Read moreSource§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T> HitDataExtra for T
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.
Source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<G> PatchFromTemplate for Gwhere
G: FromTemplate,
impl<G> PatchFromTemplate for Gwhere
G: FromTemplate,
Source§fn patch<F>(func: F) -> TemplatePatch<F, <G as PatchFromTemplate>::Template>
fn patch<F>(func: F) -> TemplatePatch<F, <G as PatchFromTemplate>::Template>
Takes a “patch function”
func, and turns it into a TemplatePatch.Source§impl<T> PatchTemplate for Twhere
T: Template,
impl<T> PatchTemplate for Twhere
T: Template,
Source§fn patch_template<F>(func: F) -> TemplatePatch<F, T>
fn patch_template<F>(func: F) -> TemplatePatch<F, T>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().impl<T> Reflectable for T
impl<T> Settings for T
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
Uses this template and the given
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clones this template. See
Clone.Source§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
Creates a type-erased clone of this value.