pub struct Size {
pub width: f64,
pub height: f64,
}Expand description
Defines a size.
Fields§
§width: f64The width.
height: f64The height.
Implementations§
Source§impl Size
impl Size
Sourcepub const fn new(width: f64, height: f64) -> Self
pub const fn new(width: f64, height: f64) -> Self
Initializes a new instance of the Size structure.
Sourcepub fn aspect_ratio(&self) -> f64
pub fn aspect_ratio(&self) -> f64
Gets the aspect ratio of the size.
Sourcepub fn parse(s: &str) -> Result<Self, FormatError>
pub fn parse(s: &str) -> Result<Self, FormatError>
Parses a Size string ("width, height" or "width height").
Sourcepub fn constrain(&self, constraint: Size) -> Size
pub fn constrain(&self, constraint: Size) -> Size
Constrains the size: each dimension becomes the smaller of this size’s and the constraint’s.
Sourcepub fn deflate(&self, thickness: Thickness) -> Size
pub fn deflate(&self, thickness: Thickness) -> Size
Deflates the size by a Thickness. The result never has negative dimensions.
Sourcepub fn equals(&self, other: Size) -> bool
pub fn equals(&self, other: Size) -> bool
Returns a boolean indicating whether the size is equal to the other given size (exact comparison of the dimensions).
Sourcepub fn nearly_equals(&self, other: Size) -> bool
pub fn nearly_equals(&self, other: Size) -> bool
Returns a boolean indicating whether the size is equal to the other given size (numerically, within a relative epsilon).
Sourcepub const fn with_width(&self, width: f64) -> Size
pub const fn with_width(&self, width: f64) -> Size
Returns a new Size with the same height and the specified width.
Sourcepub const fn with_height(&self, height: f64) -> Size
pub const fn with_height(&self, height: f64) -> Size
Returns a new Size with the same width and the specified height.
Sourcepub const fn deconstruct(&self) -> (f64, f64)
pub const fn deconstruct(&self) -> (f64, f64)
Deconstructs the size into its width and height values.
Trait Implementations§
Source§impl AddAssign for Size
impl AddAssign for Size
Source§fn add_assign(&mut self, rhs: Size)
fn add_assign(&mut self, rhs: Size)
+= operation. Read moreSource§impl AddAssign<Thickness> for Size
impl AddAssign<Thickness> for Size
Source§fn add_assign(&mut self, thickness: Thickness)
fn add_assign(&mut self, thickness: Thickness)
+= operation. Read moreSource§impl BatchValue for Size
impl BatchValue for Size
impl Copy for Size
Source§impl DivAssign<Vector> for Size
impl DivAssign<Vector> for Size
Source§fn div_assign(&mut self, scale: Vector)
fn div_assign(&mut self, scale: Vector)
/= operation. Read moreSource§impl DivAssign<f64> for Size
impl DivAssign<f64> for Size
Source§fn div_assign(&mut self, scale: f64)
fn div_assign(&mut self, scale: f64)
/= operation. Read moreSource§impl MarkupTyped for Size
impl MarkupTyped for Size
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Source§impl MulAssign<Vector> for Size
impl MulAssign<Vector> for Size
Source§fn mul_assign(&mut self, scale: Vector)
fn mul_assign(&mut self, scale: Vector)
*= operation. Read moreSource§impl MulAssign<f64> for Size
impl MulAssign<f64> for Size
Source§fn mul_assign(&mut self, scale: f64)
fn mul_assign(&mut self, scale: f64)
*= operation. Read moreSource§impl ServerPropertyValue for Size
impl ServerPropertyValue for Size
impl StructuralPartialEq for Size
Source§impl SubAssign for Size
impl SubAssign for Size
Source§fn sub_assign(&mut self, rhs: Size)
fn sub_assign(&mut self, rhs: Size)
-= operation. Read moreSource§impl SubAssign<Thickness> for Size
impl SubAssign<Thickness> for Size
Source§fn sub_assign(&mut self, thickness: Thickness)
fn sub_assign(&mut self, thickness: Thickness)
-= operation. Read moreSource§impl Transition<Size> for SizeTransition
impl Transition<Size> for SizeTransition
Source§fn do_transition(
this: &Self,
progress: Rc<dyn IObservable<f64>>,
old_value: Size,
new_value: Size,
) -> Rc<dyn IObservable<Size>>
fn do_transition( this: &Self, progress: Rc<dyn IObservable<f64>>, old_value: Size, new_value: Size, ) -> Rc<dyn IObservable<Size>>
old_value to new_value, driven by progress (from 0 to 1).Auto Trait Implementations§
impl Freeze for Size
impl RefUnwindSafe for Size
impl Send for Size
impl Sync for Size
impl Unpin for Size
impl UnsafeUnpin for Size
impl UnwindSafe for Size
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more