[−][src]Struct piet_common::kurbo::Size
A 2d size.
Fields
width: f64The width.
height: f64The height.
Methods
impl Size[src]
pub const ZERO: Size[src]
A size with zero width or height.
pub const fn new(width: f64, height: f64) -> Size[src]
Create a new Size with the provided width and height.
pub fn clamp(self, min: Size, max: Size) -> Size[src]
Returns a new size bounded by min and max.
Examples
use kurbo::Size; let this = Size::new(0., 100.); let min = Size::new(10., 10.,); let max = Size::new(50., 50.); assert_eq!(this.clamp(min, max), Size::new(10., 50.))
pub const fn to_vec2(self) -> Vec2[src]
Convert this size into a Vec2, with width mapped to x and height
mapped to y.
pub fn round(self) -> Size[src]
A new Size, with each of width and height rounded to the nearest
integer value.
Trait Implementations
impl Clone for Size[src]
fn clone(&self) -> Size[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for Size[src]
impl Debug for Size[src]
impl Default for Size[src]
impl Display for Size[src]
impl From<(f64, f64)> for Size[src]
impl Mul<f64> for Size[src]
type Output = Size
The resulting type after applying the * operator.
fn mul(self, other: f64) -> Size[src]
impl MulAssign<f64> for Size[src]
fn mul_assign(&mut self, other: f64)[src]
impl PartialEq<Size> for Size[src]
impl StructuralPartialEq for Size[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> RoundFrom<T> for T[src]
fn round_from(x: T) -> T[src]
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>, [src]
U: RoundFrom<T>,
fn round_into(self) -> U[src]
impl<T> Same<T> for T[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,