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 361)
342 pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
343 commands.spawn((Camera2d, DespawnOnExit(super::Scene::SpriteSlicing)));
344
345 let texture = asset_server.load("textures/slice_square_2.png");
346 let font = asset_server.load("fonts/FiraSans-Bold.ttf");
347
348 commands.spawn((
349 Sprite {
350 image: texture.clone(),
351 ..default()
352 },
353 Transform::from_translation(Vec3::new(-150.0, 50.0, 0.0)).with_scale(Vec3::splat(2.0)),
354 DespawnOnExit(super::Scene::SpriteSlicing),
355 ));
356
357 commands.spawn((
358 Sprite {
359 image: texture,
360 image_mode: SpriteImageMode::Sliced(TextureSlicer {
361 border: BorderRect::all(20.0),
362 center_scale_mode: SliceScaleMode::Stretch,
363 ..default()
364 }),
365 custom_size: Some(Vec2::new(200.0, 200.0)),
366 ..default()
367 },
368 Transform::from_translation(Vec3::new(150.0, 50.0, 1.0)),
369 DespawnOnExit(super::Scene::SpriteSlicing),
370 ));
371
372 commands.spawn((
373 Text2d::new("Original"),
374 TextFont {
375 font: FontSource::from(font.clone()),
376 font_size: FontSize::Px(20.0),
377 ..default()
378 },
379 Transform::from_translation(Vec3::new(-150.0, -80.0, 0.0)),
380 DespawnOnExit(super::Scene::SpriteSlicing),
381 ));
382
383 commands.spawn((
384 Text2d::new("Sliced"),
385 TextFont {
386 font: FontSource::from(font.clone()),
387 font_size: FontSize::Px(20.0),
388 ..default()
389 },
390 Transform::from_translation(Vec3::new(150.0, -80.0, 0.0)),
391 DespawnOnExit(super::Scene::SpriteSlicing),
392 ));
393 }More examples
examples/ui/images/ui_texture_slice.rs (line 92)
88fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
89 let image = asset_server.load("textures/fantasy_ui_borders/panel-border-010.png");
90
91 let slicer = TextureSlicer {
92 border: BorderRect::all(22.0),
93 center_scale_mode: SliceScaleMode::Stretch,
94 sides_scale_mode: SliceScaleMode::Stretch,
95 max_corner_scale: 1.0,
96 };
97 // ui camera
98 commands.spawn(Camera2d);
99 commands
100 .spawn(Node {
101 width: percent(100),
102 height: percent(100),
103 align_items: AlignItems::Center,
104 justify_content: JustifyContent::Center,
105 ..default()
106 })
107 .with_children(|parent| {
108 for [w, h] in [[150.0, 150.0], [300.0, 150.0], [150.0, 300.0]] {
109 parent.spawn((
110 Button,
111 // Required so the button tracks hover state (used by `button_system`).
112 Hovered::default(),
113 ImageNode {
114 image: image.clone(),
115 image_mode: NodeImageMode::Sliced(slicer.clone()),
116 ..default()
117 },
118 Node {
119 width: px(w),
120 height: px(h),
121 // horizontally center child text
122 justify_content: JustifyContent::Center,
123 // vertically center child text
124 align_items: AlignItems::Center,
125 margin: UiRect::all(px(20)),
126 ..default()
127 },
128 children![(
129 Text::new("Button"),
130 TextFont {
131 font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
132 font_size: FontSize::Px(33.0),
133 ..default()
134 },
135 TextColor(Color::srgb(0.9, 0.9, 0.9)),
136 )],
137 ));
138 }
139 });
140}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 98)
87fn setup(
88 mut commands: Commands,
89 asset_server: Res<AssetServer>,
90 mut texture_atlases: ResMut<Assets<TextureAtlasLayout>>,
91) {
92 let texture_handle = asset_server.load("textures/fantasy_ui_borders/border_sheet.png");
93 let atlas_layout =
94 TextureAtlasLayout::from_grid(UVec2::new(50, 50), 6, 6, Some(UVec2::splat(2)), None);
95 let atlas_layout_handle = texture_atlases.add(atlas_layout);
96
97 let slicer = TextureSlicer {
98 border: BorderRect::all(24.0),
99 center_scale_mode: SliceScaleMode::Stretch,
100 sides_scale_mode: SliceScaleMode::Stretch,
101 max_corner_scale: 1.0,
102 };
103 // ui camera
104 commands.spawn(Camera2d);
105 commands
106 .spawn(Node {
107 width: percent(100),
108 height: percent(100),
109 align_items: AlignItems::Center,
110 justify_content: JustifyContent::Center,
111 ..default()
112 })
113 .with_children(|parent| {
114 for (idx, [w, h]) in [
115 (0, [150.0, 150.0]),
116 (7, [300.0, 150.0]),
117 (13, [150.0, 300.0]),
118 ] {
119 parent
120 .spawn((
121 Button,
122 Hovered::default(),
123 ImageNode::from_atlas_image(
124 texture_handle.clone(),
125 TextureAtlas {
126 index: idx,
127 layout: atlas_layout_handle.clone(),
128 },
129 )
130 .with_mode(NodeImageMode::Sliced(slicer.clone())),
131 Node {
132 width: px(w),
133 height: px(h),
134 // horizontally center child text
135 justify_content: JustifyContent::Center,
136 // vertically center child text
137 align_items: AlignItems::Center,
138 margin: px(20).all(),
139 ..default()
140 },
141 ))
142 .with_children(|parent| {
143 parent.spawn((
144 Text::new("Button"),
145 TextFont {
146 font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
147 font_size: FontSize::Px(33.0),
148 ..default()
149 },
150 TextColor(Color::srgb(0.9, 0.9, 0.9)),
151 ));
152 });
153 }
154 });
155}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 1998)
1993 pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
1994 commands.spawn((Camera2d, DespawnOnExit(super::Scene::Slice)));
1995 let image = asset_server.load("textures/fantasy_ui_borders/numbered_slices.png");
1996
1997 let slicer = TextureSlicer {
1998 border: BorderRect::all(16.0),
1999 center_scale_mode: SliceScaleMode::Tile { stretch_value: 1.0 },
2000 sides_scale_mode: SliceScaleMode::Tile { stretch_value: 1.0 },
2001 ..default()
2002 };
2003 commands
2004 .spawn((
2005 Node {
2006 width: percent(100),
2007 height: percent(100),
2008 flex_direction: FlexDirection::Column,
2009 justify_content: JustifyContent::SpaceAround,
2010 align_content: AlignContent::Center,
2011 ..default()
2012 },
2013 DespawnOnExit(super::Scene::Slice),
2014 ))
2015 .with_children(|parent| {
2016 for visual_box in [
2017 VisualBox::BorderBox,
2018 VisualBox::PaddingBox,
2019 VisualBox::ContentBox,
2020 ] {
2021 parent
2022 .spawn(Node {
2023 justify_content: JustifyContent::SpaceAround,
2024 ..default()
2025 })
2026 .with_children(|parent| {
2027 for [w, h] in [[200.0, 200.0], [300.0, 200.0], [150., 200.0]] {
2028 parent.spawn((
2029 ImageNode {
2030 image: image.clone(),
2031 image_mode: NodeImageMode::Sliced(slicer.clone()),
2032 visual_box,
2033 ..default()
2034 },
2035 Node {
2036 width: px(w),
2037 height: px(h),
2038 border: px(20.).all(),
2039 padding: px(20.).all(),
2040 ..default()
2041 },
2042 Outline {
2043 width: px(2.),
2044 ..default()
2045 },
2046 ));
2047 }
2048
2049 parent.spawn((
2050 ImageNode {
2051 image: asset_server
2052 .load("textures/fantasy_ui_borders/panel-border-010.png"),
2053 image_mode: NodeImageMode::Sliced(TextureSlicer {
2054 border: BorderRect::all(22.0),
2055 center_scale_mode: SliceScaleMode::Stretch,
2056 sides_scale_mode: SliceScaleMode::Stretch,
2057 max_corner_scale: 1.0,
2058 }),
2059 visual_box,
2060 ..Default::default()
2061 },
2062 Node {
2063 width: px(200),
2064 height: px(200),
2065 border: px(20.).all(),
2066 padding: px(20.).all(),
2067 ..default()
2068 },
2069 Outline {
2070 color: bevy::color::palettes::css::DARK_CYAN.into(),
2071 width: px(2.),
2072 ..default()
2073 },
2074 BackgroundColor(bevy::color::palettes::css::NAVY.into()),
2075 ));
2076 });
2077 }
2078 });
2079 }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§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) -> Result<Box<dyn PartialReflect>, ReflectCloneError>
fn to_dynamic(&self) -> Result<Box<dyn PartialReflect>, ReflectCloneError>
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) -> Result<DynamicStruct, ReflectCloneError>
fn to_dynamic_struct(&self) -> Result<DynamicStruct, ReflectCloneError>
Creates a new
DynamicStruct from this struct. Read moreSource§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
self.