pub struct SizePolicy {
pub min_size: Size2,
pub size: Size2,
pub max_size: Size2,
pub aspect_ratio: Option<AspectRatio>,
pub grow: Grow,
}Expand description
How an element is sized, written for its horizontal orientation (the vertical orientation swaps the axes).
Fields§
§min_size: Size2The smallest size the element accepts. Below it, the element steps down to its next form.
size: Size2The preferred size, the one the element is placed at.
max_size: Size2The largest size growth may reach.
aspect_ratio: Option<AspectRatio>A width-to-height ratio the element keeps, if any.
grow: GrowWhether, and along which axis, the element grows.
Implementations§
Source§impl SizePolicy
impl SizePolicy
Sourcepub const fn fixed(size: Size2) -> SizePolicy
pub const fn fixed(size: Size2) -> SizePolicy
A fixed element of one size.
Sourcepub const fn growable(
min_size: Size2,
size: Size2,
max_size: Size2,
axis: Axis,
) -> SizePolicy
pub const fn growable( min_size: Size2, size: Size2, max_size: Size2, axis: Axis, ) -> SizePolicy
A growable element: placed at size, accepting down to min_size,
growing along axis up to max_size.
Sourcepub const fn with_aspect_ratio(self, width: u32, height: u32) -> SizePolicy
pub const fn with_aspect_ratio(self, width: u32, height: u32) -> SizePolicy
The same policy keeping an aspect ratio.
Trait Implementations§
Source§impl Clone for SizePolicy
impl Clone for SizePolicy
Source§fn clone(&self) -> SizePolicy
fn clone(&self) -> SizePolicy
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 SizePolicy
impl Debug for SizePolicy
Source§impl<'de> Deserialize<'de> for SizePolicy
impl<'de> Deserialize<'de> for SizePolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for SizePolicy
impl Hash for SizePolicy
Source§impl PartialEq for SizePolicy
impl PartialEq for SizePolicy
Source§impl Serialize for SizePolicy
impl Serialize for SizePolicy
impl Copy for SizePolicy
impl Eq for SizePolicy
impl StructuralPartialEq for SizePolicy
Auto Trait Implementations§
impl Freeze for SizePolicy
impl RefUnwindSafe for SizePolicy
impl Send for SizePolicy
impl Sync for SizePolicy
impl Unpin for SizePolicy
impl UnsafeUnpin for SizePolicy
impl UnwindSafe for SizePolicy
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