Skip to main content

LtrbRect

Struct LtrbRect 

Source
pub struct LtrbRect {
    pub left: f64,
    pub top: f64,
    pub right: f64,
    pub bottom: f64,
}
Expand description

A rectangle stored as left/top/right/bottom edges.

Fields§

§left: f64§top: f64§right: f64§bottom: f64

Implementations§

Source§

impl LtrbRect

Source

pub const INFINITE: LtrbRect

Source

pub const fn new(left: f64, top: f64, right: f64, bottom: f64) -> Self

Source

pub fn from_rect(rc: Rect) -> Self

Source

pub fn width(&self) -> f64

Source

pub fn height(&self) -> f64

Source

pub fn is_well_ordered(&self) -> bool

Source

pub fn is_zero_size(&self) -> bool

Source

pub fn is_empty(&self) -> bool

Source

pub fn null_if_zero_size(self) -> Option<LtrbRect>

Source

pub fn intersect_or_null(&self, rect: LtrbRect) -> Option<LtrbRect>

Source

pub fn intersect_or_empty(&self, rect: LtrbRect) -> LtrbRect

Source

pub fn intersects(&self, rect: LtrbRect) -> bool

Source

pub fn contains(&self, x: f64, y: f64) -> bool

Source

pub fn to_rect(&self) -> Rect

Source

pub fn inflate(&self, thickness: Thickness) -> LtrbRect

Source

pub fn top_left(&self) -> Point

The axis-aligned bounding box of the rectangle transformed by matrix.

Source

pub fn top_right(&self) -> Point

Source

pub fn bottom_left(&self) -> Point

Source

pub fn bottom_right(&self) -> Point

Source

pub fn transform_to_aabb(&self, matrix: Matrix) -> LtrbRect

Source

pub fn full_union( left: Option<LtrbRect>, right: Option<LtrbRect>, ) -> Option<LtrbRect>

The union of two optional rectangles, where None is the empty set.

Source

pub fn full_union_rect( left: Option<LtrbRect>, right: Option<Rect>, ) -> Option<LtrbRect>

The union of an optional rectangle with an optional Rect, where None is the empty set.

Source

pub fn union(&self, rect: LtrbRect) -> LtrbRect

Source

pub fn contains_rect(&self, rect: LtrbRect) -> bool

Whether the rectangle contains another one, edges included.

Trait Implementations§

Source§

impl Clone for LtrbRect

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for LtrbRect

Source§

impl Debug for LtrbRect

Source§

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

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

impl Default for LtrbRect

Source§

fn default() -> Self

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

impl Display for LtrbRect

Source§

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

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

impl PartialEq for LtrbRect

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LtrbRect

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> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> PropertyValue for T
where T: Clone + PartialEq + 'static,

Source§

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

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.