pub trait View:
Debug
+ Clone
+ Default {
Show 17 methods
// Required methods
fn name_node(&mut self) -> &mut Name;
fn node_node(&mut self) -> &mut Node;
// Provided methods
fn new() -> Self { ... }
fn from_name(name: impl Into<Cow<'static, str>>) -> Self { ... }
fn name(self, name: impl Into<Cow<'static, str>>) -> Self { ... }
fn padding(self, padding: UiRect) -> Self { ... }
fn frame(self, width: Val, height: Val) -> Self { ... }
fn width(self, val: Val) -> Self { ... }
fn max_width(self, val: Val) -> Self { ... }
fn min_width(self, val: Val) -> Self { ... }
fn height(self, val: Val) -> Self { ... }
fn max_height(self, val: Val) -> Self { ... }
fn min_height(self, val: Val) -> Self { ... }
fn flex_grow(self, grow: f32) -> Self { ... }
fn flex_shrink(self, shrink: f32) -> Self { ... }
fn grid_row(self, row: GridPlacement) -> Self { ... }
fn grid_column(self, column: GridPlacement) -> Self { ... }
}Expand description
Provides a builder-style trait for configuring UI elements using a fluent interface.
Types implementing View must define how to access their Name
and Node components. This trait simplifies layout and styling
tasks through expressive method chaining.
Required Methods§
Provided Methods§
Sourcefn new() -> Self
fn new() -> Self
Creates a new instance using the type’s Default implementation.
This is a convenient shorthand when no customization is needed.
Sourcefn from_name(name: impl Into<Cow<'static, str>>) -> Self
fn from_name(name: impl Into<Cow<'static, str>>) -> Self
Constructs a new instance and sets its Name component.
§Arguments
name- A name to assign to this instance, typically used for entity identification or debugging purposes.
Sourcefn name(self, name: impl Into<Cow<'static, str>>) -> Self
fn name(self, name: impl Into<Cow<'static, str>>) -> Self
Sets the Name component of this instance.
Helpful for tracking or debugging UI entities.
§Arguments
name- The name to assign, provided as a&str,String, orCow.
Sourcefn padding(self, padding: UiRect) -> Self
fn padding(self, padding: UiRect) -> Self
Sets the padding (insets) around the content of the Node.
§Arguments
padding- AUiRectdefining spacing on all four sides.
Sourcefn frame(self, width: Val, height: Val) -> Self
fn frame(self, width: Val, height: Val) -> Self
Sets both the width and height of the Node.
§Arguments
width- The desired width usingVal::Px,Val::Percent, etc.height- The desired height using the sameValenum.
Sourcefn max_width(self, val: Val) -> Self
fn max_width(self, val: Val) -> Self
Sets the maximum width constraint of the Node.
Prevents the node from expanding beyond this limit.
Sourcefn min_width(self, val: Val) -> Self
fn min_width(self, val: Val) -> Self
Sets the minimum width constraint of the Node.
Ensures the node does not shrink below this value.
Sourcefn max_height(self, val: Val) -> Self
fn max_height(self, val: Val) -> Self
Sets the maximum height constraint of the Node.
Prevents the node from growing beyond this value.
Sourcefn min_height(self, val: Val) -> Self
fn min_height(self, val: Val) -> Self
Sets the minimum height constraint of the Node.
Ensures the node maintains at least this size.
Sourcefn flex_grow(self, grow: f32) -> Self
fn flex_grow(self, grow: f32) -> Self
Sets the flex_grow factor of the Node.
Determines how much the node should grow relative to its siblings.
Sourcefn flex_shrink(self, shrink: f32) -> Self
fn flex_shrink(self, shrink: f32) -> Self
Sets the flex_shrink factor of the Node.
Controls how much the node should shrink when space is constrained.
Sourcefn grid_row(self, row: GridPlacement) -> Self
fn grid_row(self, row: GridPlacement) -> Self
Sourcefn grid_column(self, column: GridPlacement) -> Self
fn grid_column(self, column: GridPlacement) -> Self
Assigns this node to a specific grid column in a grid layout.
§Arguments
column- The grid column position.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.