pub struct Rect<U> {
pub v: f32x4,
/* private fields */
}
Expand description
Represents a 2D Rectangle, similar to the Euclid rectangle, but SSE optimized and uses a LTRB absolute representation, instead of a position and a size.
Fields§
§v: f32x4
Implementations§
Source§impl<U> Rect<U>
impl<U> Rect<U>
pub const fn new(left: f32, top: f32, right: f32, bottom: f32) -> Self
pub const fn splat(x: f32) -> Self
pub const fn corners( topleft: Point2D<f32, U>, bottomright: Point2D<f32, U>, ) -> Self
pub fn contains(&self, p: Point2D<f32, U>) -> bool
pub fn collides(&self, rhs: &Self) -> bool
pub fn intersect(&self, rhs: Self) -> Self
pub fn extend(&self, rhs: Self) -> Self
pub fn topleft(&self) -> Point2D<f32, U>
pub fn set_topleft(&mut self, v: Point2D<f32, U>)
pub fn bottomright(&self) -> Point2D<f32, U>
pub fn set_bottomright(&mut self, v: Point2D<f32, U>)
pub fn dim(&self) -> Size2D<f32, U>
pub const fn zero() -> Self
pub const fn unit() -> Self
Sourcepub fn to_untyped(self) -> PxRect
pub fn to_untyped(self) -> PxRect
Discard the units
Trait Implementations§
impl<U: Copy> Copy for Rect<U>
impl<U: Copy + 'static> NoUninit for Rect<U>
impl<U> StructuralPartialEq for Rect<U>
Auto Trait Implementations§
impl<U> Freeze for Rect<U>
impl<U> RefUnwindSafe for Rect<U>where
U: RefUnwindSafe,
impl<U> Send for Rect<U>where
U: Send,
impl<U> Sync for Rect<U>where
U: Sync,
impl<U> Unpin for Rect<U>where
U: Unpin,
impl<U> UnwindSafe for Rect<U>where
U: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromLuaMulti for Twhere
T: FromLua,
impl<T> FromLuaMulti for Twhere
T: FromLua,
Source§fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
Performs the conversion. Read more
fn from_lua_args( args: MultiValue, i: usize, to: Option<&str>, lua: &Lua, ) -> Result<T, Error>
unsafe fn from_stack_multi(nvals: i32, lua: &RawLua) -> Result<T, Error>
unsafe fn from_stack_args( nargs: i32, i: usize, to: Option<&str>, lua: &RawLua, ) -> Result<T, Error>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.