pub struct LayoutSizeHint {
pub min: u16,
pub preferred: u16,
pub max: Option<u16>,
}Expand description
Size hint returned by measurer callbacks for intrinsic sizing.
This is a 1D projection of a widget’s size constraints along the layout axis.
Use with Flex::split_with_measurer for content-aware layouts.
§Example
use ftui_layout::LayoutSizeHint;
// A label that needs 5-20 cells, ideally 15
let hint = LayoutSizeHint {
min: 5,
preferred: 15,
max: Some(20),
};
// Clamp allocation to hint bounds
assert_eq!(hint.clamp(10), 10); // Within range
assert_eq!(hint.clamp(3), 5); // Below min
assert_eq!(hint.clamp(30), 20); // Above maxFields§
§min: u16Minimum size (widget clips below this).
preferred: u16Preferred size (ideal for content).
max: Option<u16>Maximum useful size (None = unbounded).
Implementations§
Trait Implementations§
Source§impl Clone for LayoutSizeHint
impl Clone for LayoutSizeHint
Source§fn clone(&self) -> LayoutSizeHint
fn clone(&self) -> LayoutSizeHint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LayoutSizeHint
impl Debug for LayoutSizeHint
Source§impl Default for LayoutSizeHint
impl Default for LayoutSizeHint
Source§fn default() -> LayoutSizeHint
fn default() -> LayoutSizeHint
Returns the “default value” for a type. Read more
Source§impl PartialEq for LayoutSizeHint
impl PartialEq for LayoutSizeHint
impl Copy for LayoutSizeHint
impl Eq for LayoutSizeHint
impl StructuralPartialEq for LayoutSizeHint
Auto Trait Implementations§
impl Freeze for LayoutSizeHint
impl RefUnwindSafe for LayoutSizeHint
impl Send for LayoutSizeHint
impl Sync for LayoutSizeHint
impl Unpin for LayoutSizeHint
impl UnwindSafe for LayoutSizeHint
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
Mutably borrows from an owned value. Read more