pub struct Measured {
pub width: Option<i32>,
pub height: Option<i32>,
}Expand description
What a widget would like to be, on the axes it has an opinion about.
Per axis, and both optional, because that is what the widgets actually
are. A List has an opinion about both. An
Alert has one about its height and none about its
width — it is a banner, and a banner is as wide as you make it. A
Panel has none about either, because it is the
background other things sit on and has no content of its own.
A single Option<Size> would force a widget with an opinion about one axis
to invent one about the other, and an invented size is worse than no size:
no size, the caller notices and decides.
assert_eq!(Measured::NOTHING, Measured::default());
assert_eq!(Measured::wide(120).width, Some(120));
assert_eq!(Measured::wide(120).height, None);Fields§
§width: Option<i32>The width it would like, if it has a view.
height: Option<i32>The height it would like, if it has a view.
Implementations§
Trait Implementations§
impl Copy for Measured
impl Eq for Measured
impl StructuralPartialEq for Measured
Auto Trait Implementations§
impl Freeze for Measured
impl RefUnwindSafe for Measured
impl Send for Measured
impl Sync for Measured
impl Unpin for Measured
impl UnsafeUnpin for Measured
impl UnwindSafe for Measured
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