Struct iced_core::Size

source ·
pub struct Size<T = f32> {
    pub width: T,
    pub height: T,
}
Expand description

An amount of space in 2 dimensions.

Fields§

§width: T

The width.

§height: T

The height.

Implementations§

source§

impl<T> Size<T>

source

pub const fn new(width: T, height: T) -> Self

Creates a new Size with the given width and height.

source§

impl Size

source

pub const ZERO: Size = _

A Size with zero width and height.

source

pub const UNIT: Size = _

A Size with a width and height of 1 unit.

source

pub const INFINITY: Size = _

A Size with infinite width and height.

source

pub fn min(self, other: Self) -> Self

Returns the minimum of each component of this size and another.

source

pub fn max(self, other: Self) -> Self

Returns the maximum of each component of this size and another.

source

pub fn expand(self, other: impl Into<Size>) -> Self

Expands this Size by the given amount.

Trait Implementations§

source§

impl<T: Clone> Clone for Size<T>

source§

fn clone(&self) -> Size<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for Size<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<[f32; 2]> for Size

source§

fn from([width, height]: [f32; 2]) -> Self

Converts to this type from the input type.
source§

impl From<[u16; 2]> for Size

source§

fn from([width, height]: [u16; 2]) -> Self

Converts to this type from the input type.
source§

impl From<Padding> for Size

source§

fn from(padding: Padding) -> Self

Converts to this type from the input type.
source§

impl From<Size> for [f32; 2]

source§

fn from(size: Size) -> [f32; 2]

Converts to this type from the input type.
source§

impl From<Size> for Vector<f32>

source§

fn from(size: Size) -> Self

Converts to this type from the input type.
source§

impl From<Vector> for Size

source§

fn from(vector: Vector<f32>) -> Self

Converts to this type from the input type.
source§

impl<T: Hash> Hash for Size<T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Mul<Transformation> for Size

§

type Output = Size

The resulting type after applying the * operator.
source§

fn mul(self, transformation: Transformation) -> Self

Performs the * operation. Read more
source§

impl<T: PartialEq> PartialEq for Size<T>

source§

fn eq(&self, other: &Size<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub for Size

§

type Output = Size

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<T: Copy> Copy for Size<T>

source§

impl<T: Eq> Eq for Size<T>

source§

impl<T> StructuralPartialEq for Size<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Size<T>
where T: RefUnwindSafe,

§

impl<T> Send for Size<T>
where T: Send,

§

impl<T> Sync for Size<T>
where T: Sync,

§

impl<T> Unpin for Size<T>
where T: Unpin,

§

impl<T> UnwindSafe for Size<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.