pub struct ProposalSize {
pub width: Option<f32>,
pub height: Option<f32>,
}Expand description
A size proposal from parent to child during layout negotiation.
Each dimension can be:
None- “Tell me your ideal size” (unspecified)Some(0.0)- “Tell me your minimum size”Some(f32::INFINITY)- “Tell me your maximum size”Some(value)- “I suggest you use this size”
Children are free to return any size; the proposal is just a suggestion.
Fields§
§width: Option<f32>Width proposal: None = unspecified, Some(f32) = suggested width
height: Option<f32>Height proposal: None = unspecified, Some(f32) = suggested height
Implementations§
Source§impl ProposalSize
impl ProposalSize
Sourcepub const UNSPECIFIED: ProposalSize
pub const UNSPECIFIED: ProposalSize
Unspecified proposal - asks for ideal/intrinsic size.
Sourcepub const ZERO: ProposalSize
pub const ZERO: ProposalSize
Zero proposal - asks for minimum size.
Sourcepub const INFINITY: ProposalSize
pub const INFINITY: ProposalSize
Infinite proposal - asks for maximum size.
Sourcepub fn new(
width: impl Into<Option<f32>>,
height: impl Into<Option<f32>>,
) -> ProposalSize
pub fn new( width: impl Into<Option<f32>>, height: impl Into<Option<f32>>, ) -> ProposalSize
Creates a ProposalSize from optional width and height.
Sourcepub fn width_or(&self, default: f32) -> f32
pub fn width_or(&self, default: f32) -> f32
Returns the width or a default value if unspecified.
Sourcepub fn height_or(&self, default: f32) -> f32
pub fn height_or(&self, default: f32) -> f32
Returns the height or a default value if unspecified.
Sourcepub const fn with_width(self, width: Option<f32>) -> ProposalSize
pub const fn with_width(self, width: Option<f32>) -> ProposalSize
Replace only the width, keeping the height.
Sourcepub const fn with_height(self, height: Option<f32>) -> ProposalSize
pub const fn with_height(self, height: Option<f32>) -> ProposalSize
Replace only the height, keeping the width.
Trait Implementations§
Source§impl Clone for ProposalSize
impl Clone for ProposalSize
Source§fn clone(&self) -> ProposalSize
fn clone(&self) -> ProposalSize
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProposalSize
impl Debug for ProposalSize
Source§impl Default for ProposalSize
impl Default for ProposalSize
Source§fn default() -> ProposalSize
fn default() -> ProposalSize
Returns the “default value” for a type. Read more
Source§impl PartialEq for ProposalSize
impl PartialEq for ProposalSize
impl Copy for ProposalSize
impl StructuralPartialEq for ProposalSize
Auto Trait Implementations§
impl Freeze for ProposalSize
impl RefUnwindSafe for ProposalSize
impl Send for ProposalSize
impl Sync for ProposalSize
impl Unpin for ProposalSize
impl UnwindSafe for ProposalSize
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)