pub struct Node<State> { /* private fields */ }Expand description
A layout tree node. Use methods in crate::nodes to create nodes.
Implementations§
source§impl<U> Node<U>
impl<U> Node<U>
sourcepub fn pad_leading(self, amount: f32) -> Node<U>
pub fn pad_leading(self, amount: f32) -> Node<U>
Adds padding to the node along the leading edge
sourcepub fn pad_x(self, amount: f32) -> Node<U>
pub fn pad_x(self, amount: f32) -> Node<U>
Adds horizontal padding to the node (leading & trailing)
sourcepub fn pad_trailing(self, amount: f32) -> Node<U>
pub fn pad_trailing(self, amount: f32) -> Node<U>
Adds padding to the node along the trailing edge
sourcepub fn pad_bottom(self, amount: f32) -> Node<U>
pub fn pad_bottom(self, amount: f32) -> Node<U>
Adds padding to the node along the bottom edge
sourcepub fn offset_x(self, amount: f32) -> Node<U>
pub fn offset_x(self, amount: f32) -> Node<U>
Offsets the node along the x axis. This is an absolute offset that simply shifts nodes away from their calculated position This won’t impact layout besides child nodes also being offset
sourcepub fn offset_y(self, amount: f32) -> Node<U>
pub fn offset_y(self, amount: f32) -> Node<U>
Offsets the node along the y axis. This is an absolute offset that simply shifts nodes away from their calculated position This won’t impact layout besides child nodes also being offset
sourcepub fn offset(self, offset_x: f32, offset_y: f32) -> Node<U>
pub fn offset(self, offset_x: f32, offset_y: f32) -> Node<U>
Offsets the node along the x & y axis. This is an absolute offset that simply shifts nodes away from their calculated position This won’t impact layout besides child nodes also being offset
sourcepub fn height_range<R>(self, range: R) -> Selfwhere
R: RangeBounds<f32>,
pub fn height_range<R>(self, range: R) -> Selfwhere
R: RangeBounds<f32>,
Specifies bounds on a node’s height
sourcepub fn width_range<R>(self, range: R) -> Selfwhere
R: RangeBounds<f32>,
pub fn width_range<R>(self, range: R) -> Selfwhere
R: RangeBounds<f32>,
Specifies bounds on a node’s width
sourcepub fn align(self, align: Align) -> Self
pub fn align(self, align: Align) -> Self
Specifies an alignment along the x and/or y axis.
This will only have an effect if the node is constrained along the axis to be smaller than the area that is available, otherwise, there’s no wiggle room.
sourcepub fn dynamic_height(self, f: impl Fn(f32, &mut U) -> f32 + 'static) -> Self
pub fn dynamic_height(self, f: impl Fn(f32, &mut U) -> f32 + 'static) -> Self
Constrains the node’s height as a function of available width.
Generally you should prefer size constraints, aspect ratio constraints or area readers over dynamic height.
This is primarily for UI elements such as text where node height must depend on available width & scaling is not a simple option.
sourcepub fn dynamic_width(self, f: impl Fn(f32, &mut U) -> f32 + 'static) -> Self
pub fn dynamic_width(self, f: impl Fn(f32, &mut U) -> f32 + 'static) -> Self
Constrains the node’s width as a function of available height.
Generally you should prefer size constraints, aspect ratio constraints or area readers over dynamic height.
This is primarily for UI elements such as text where node width must depend on available height & scaling is not a simple option.
Trait Implementations§
Auto Trait Implementations§
impl<State> Freeze for Node<State>
impl<State> !RefUnwindSafe for Node<State>
impl<State> !Send for Node<State>
impl<State> !Sync for Node<State>
impl<State> Unpin for Node<State>
impl<State> !UnwindSafe for Node<State>
Blanket Implementations§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)