orbtk_tinyskia::utils

Struct ConstraintBuilder

Source
pub struct ConstraintBuilder { /* private fields */ }
Expand description

Used to capture constraint properties.

Implementations§

Source§

impl ConstraintBuilder

The ConstraintBuilder is used to crate the constraint porperties of an entity.

Constraints will provide properties that are used to determine the size requirements of an entity. It will store minimum and maximim values for its height and width, next to the current values.

Source

pub fn new() -> ConstraintBuilder

Creates a new ConstraintBuilder with default values.

Source

pub fn width(self, width: impl Into<f64>) -> ConstraintBuilder

Inserts a new width.

Source

pub fn height(self, height: impl Into<f64>) -> ConstraintBuilder

Inserts a new height.

Source

pub fn size( self, width: impl Into<f64>, height: impl Into<f64>, ) -> ConstraintBuilder

Inserts a new size.

Source

pub fn min_width(self, min_width: impl Into<f64>) -> ConstraintBuilder

Inserts a new min_width.

Source

pub fn min_height(self, min_height: impl Into<f64>) -> ConstraintBuilder

Inserts a new min_height.

Source

pub fn min_size( self, min_width: impl Into<f64>, min_height: impl Into<f64>, ) -> ConstraintBuilder

Inserts a new min_size.

Source

pub fn max_width(self, max_width: impl Into<f64>) -> ConstraintBuilder

Inserts a new max_width.

Source

pub fn max_height(self, max_height: impl Into<f64>) -> ConstraintBuilder

Inserts a new max_height.

Source

pub fn max_size( self, max_width: impl Into<f64>, max_height: impl Into<f64>, ) -> ConstraintBuilder

Inserts a new min_size.

Source

pub fn build(self) -> Constraint

Builds the constraint.

Trait Implementations§

Source§

impl Default for ConstraintBuilder

Source§

fn default() -> ConstraintBuilder

Returns the “default value” for a type. Read more
Source§

impl From<ConstraintBuilder> for Constraint

Source§

fn from(builder: ConstraintBuilder) -> Constraint

Converts to this type from the input type.

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.