pub struct Offer {
pub width: Option<i32>,
pub height: Option<i32>,
}Expand description
What a caller can promise a widget about the space it will get.
Not a constraint in the layout-engine sense: there is no minimum, no maximum
and nothing to satisfy. It is the one fact a widget may need in order to
answer at all — an Alert has no height until it
knows the width its text wraps to, and a Rating
has no width until it knows how tall its stars are.
None on an axis means the caller cannot promise anything there, which is
the usual case and the default.
// "You will get 300 pixels of width; the height is up to you."
let offer = Offer::wide(300);
assert_eq!(offer.width, Some(300));
assert_eq!(offer.height, None);
assert_eq!(Offer::NOTHING, Offer::default());Fields§
§width: Option<i32>The width the caller can promise, if it can promise one.
height: Option<i32>The height, likewise.
Implementations§
Trait Implementations§
impl Copy for Offer
impl Eq for Offer
impl StructuralPartialEq for Offer
Auto Trait Implementations§
impl Freeze for Offer
impl RefUnwindSafe for Offer
impl Send for Offer
impl Sync for Offer
impl Unpin for Offer
impl UnsafeUnpin for Offer
impl UnwindSafe for Offer
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