Struct Rect

Source
pub struct Rect<T, Coord> {
    pub left: T,
    pub top: T,
    pub right: T,
    pub bottom: T,
    /* private fields */
}

Fields§

§left: T§top: T§right: T§bottom: T

Implementations§

Source§

impl<T, Coord> Rect<T, Coord>

Source

pub const fn new(left: T, top: T, right: T, bottom: T) -> Rect<T, Coord>

Source

pub fn from_positions( left_top: impl Into<Position<T, Coord>>, right_bottom: impl Into<Position<T, Coord>>, ) -> Rect<T, Coord>

Source

pub fn from_position_size( position: impl Into<Position<T, Coord>>, size: impl Into<Size<T, Coord>>, ) -> Rect<T, Coord>
where T: Add<Output = T> + Clone,

Source

pub fn left_top(&self) -> Position<T, Coord>
where T: Clone,

Source

pub fn left_bottom(&self) -> Position<T, Coord>
where T: Clone,

Source

pub fn right_top(&self) -> Position<T, Coord>
where T: Clone,

Source

pub fn right_bottom(&self) -> Position<T, Coord>
where T: Clone,

Source

pub fn size(&self) -> Size<T, Coord>
where T: Clone + Sub<Output = T>,

Trait Implementations§

Source§

impl<T, Coord> Add<Position<T, Coord>> for Rect<T, Coord>
where T: Add<Output = T> + Copy,

Source§

type Output = Rect<T, Coord>

The resulting type after applying the + operator.
Source§

fn add( self, rhs: Position<T, Coord>, ) -> <Rect<T, Coord> as Add<Position<T, Coord>>>::Output

Performs the + operation. Read more
Source§

impl<T, Coord> Add<Rect<T, Coord>> for Position<T, Coord>
where T: Add<Output = T> + Copy,

Source§

type Output = Rect<T, Coord>

The resulting type after applying the + operator.
Source§

fn add( self, rhs: Rect<T, Coord>, ) -> <Position<T, Coord> as Add<Rect<T, Coord>>>::Output

Performs the + operation. Read more
Source§

impl<T, Coord> Clone for Rect<T, Coord>
where T: Clone, Coord: Clone,

Source§

fn clone(&self) -> Rect<T, Coord>

Returns a duplicate 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, Coord> Collision<Position<T, Coord>> for Rect<T, Coord>
where T: Num + PartialOrd,

Source§

fn is_crossing(&self, rhs: &Position<T, Coord>) -> bool

Source§

fn contains(&self, inner: &Position<T, Coord>) -> bool

Source§

impl<T, Coord> Collision<Rect<T, Coord>> for Position<T, Coord>
where T: Num + PartialOrd,

Source§

fn is_crossing(&self, rhs: &Rect<T, Coord>) -> bool

Source§

fn contains(&self, inner: &Rect<T, Coord>) -> bool

Source§

impl<T, Coord> Collision<Rect<T, Coord>> for Rect<T, Coord>
where T: Num + PartialOrd,

Source§

fn is_crossing(&self, rhs: &Rect<T, Coord>) -> bool

Source§

fn contains(&self, inner: &Rect<T, Coord>) -> bool

Source§

impl<T, Coord> Debug for Rect<T, Coord>
where T: Debug, Coord: Debug,

Source§

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

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

impl<'de, T, Coord> Deserialize<'de> for Rect<T, Coord>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Rect<T, Coord>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T, Coord> Div<T> for Rect<T, Coord>
where T: Div<Output = T> + Copy,

Source§

type Output = Rect<T, Coord>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> <Rect<T, Coord> as Div<T>>::Output

Performs the / operation. Read more
Source§

impl<T, Coord> From<(T, T, T, T)> for Rect<T, Coord>

Source§

fn from(value: (T, T, T, T)) -> Rect<T, Coord>

Converts to this type from the input type.
Source§

impl From<RECT> for Rect<i32, Physical>

Source§

fn from(value: RECT) -> Rect<i32, Physical>

Converts to this type from the input type.
Source§

impl<T, Coord> Mul<T> for Rect<T, Coord>
where T: Mul<Output = T> + Copy,

Source§

type Output = Rect<T, Coord>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> <Rect<T, Coord> as Mul<T>>::Output

Performs the * operation. Read more
Source§

impl<T, Coord> PartialEq for Rect<T, Coord>
where T: PartialEq, Coord: PartialEq,

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, Coord> Serialize for Rect<T, Coord>
where T: Serialize,

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T> ToLogical<T> for Rect<T, Logical>
where T: Copy,

Source§

type Output<U> = Rect<U, Logical>

Source§

fn to_logical(&self, _dpi: T) -> <Rect<T, Logical> as ToLogical<T>>::Output<T>

Source§

impl<T> ToLogical<T> for Rect<T, Physical>
where T: Num + NumCast + Copy,

Source§

type Output<U> = Rect<T, Logical>

Source§

fn to_logical(&self, dpi: T) -> <Rect<T, Physical> as ToLogical<T>>::Output<T>

Source§

impl<T> ToPhysical<T> for Rect<T, Logical>
where T: Num + NumCast + Copy,

Source§

type Output<U> = Rect<U, Physical>

Source§

fn to_physical(&self, dpi: T) -> <Rect<T, Logical> as ToPhysical<T>>::Output<T>

Source§

impl<T> ToPhysical<T> for Rect<T, Physical>
where T: Copy,

Source§

type Output<U> = Rect<U, Physical>

Source§

fn to_physical( &self, _dpi: T, ) -> <Rect<T, Physical> as ToPhysical<T>>::Output<T>

Source§

impl<T, Coord> Copy for Rect<T, Coord>
where T: Copy, Coord: Copy,

Source§

impl<T, Coord> Eq for Rect<T, Coord>
where T: Eq, Coord: Eq,

Source§

impl<T, Coord> StructuralPartialEq for Rect<T, Coord>

Auto Trait Implementations§

§

impl<T, Coord> Freeze for Rect<T, Coord>
where T: Freeze,

§

impl<T, Coord> RefUnwindSafe for Rect<T, Coord>
where T: RefUnwindSafe, Coord: RefUnwindSafe,

§

impl<T, Coord> Send for Rect<T, Coord>
where T: Send, Coord: Send,

§

impl<T, Coord> Sync for Rect<T, Coord>
where T: Sync, Coord: Sync,

§

impl<T, Coord> Unpin for Rect<T, Coord>
where T: Unpin, Coord: Unpin,

§

impl<T, Coord> UnwindSafe for Rect<T, Coord>
where T: UnwindSafe, Coord: 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> 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> 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, 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,