pub struct Offset(pub i32, pub i32);
Expand description
Tuple Fields§
§0: i32
§1: i32
Implementations§
Source§impl Offset
impl Offset
Sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to the specified interval, componentwise
Sourcepub fn distance_l1(self) -> i32
pub fn distance_l1(self) -> i32
Return the L1 (rectilinear / taxicab) distance
Sourcepub fn distance_l_inf(self) -> i32
pub fn distance_l_inf(self) -> i32
Return the L-inf (max) distance
Sourcepub fn extract<D: Directional>(self, dir: D) -> i32
pub fn extract<D: Directional>(self, dir: D) -> i32
Extract one component, based on a direction
This merely extracts the horizontal or vertical component. It never negates it, even if the axis is reversed.
Sourcepub fn set_component<D: Directional>(&mut self, dir: D, value: i32)
pub fn set_component<D: Directional>(&mut self, dir: D, value: i32)
Set one component of self, based on a direction
This does not negate components when the direction is reversed.
Trait Implementations§
Source§impl AddAssign<Offset> for Coord
impl AddAssign<Offset> for Coord
Source§fn add_assign(&mut self, rhs: Offset)
fn add_assign(&mut self, rhs: Offset)
Performs the
+=
operation. Read moreSource§impl AddAssign<Offset> for Event
impl AddAssign<Offset> for Event
Source§fn add_assign(&mut self, offset: Offset)
fn add_assign(&mut self, offset: Offset)
Performs the
+=
operation. Read moreSource§impl AddAssign<Offset> for Rect
impl AddAssign<Offset> for Rect
Source§fn add_assign(&mut self, offset: Offset)
fn add_assign(&mut self, offset: Offset)
Performs the
+=
operation. Read moreSource§impl AddAssign for Offset
impl AddAssign for Offset
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl ConvApprox<DVec2> for Offset
impl ConvApprox<DVec2> for Offset
Source§fn try_conv_approx(arg: DVec2) -> Result<Self>
fn try_conv_approx(arg: DVec2) -> Result<Self>
Source§fn conv_approx(x: T) -> Self
fn conv_approx(x: T) -> Self
Source§impl ConvApprox<Vec2> for Offset
impl ConvApprox<Vec2> for Offset
Source§fn try_conv_approx(arg: Vec2) -> Result<Self>
fn try_conv_approx(arg: Vec2) -> Result<Self>
Source§fn conv_approx(x: T) -> Self
fn conv_approx(x: T) -> Self
Source§impl ConvFloat<DVec2> for Offset
impl ConvFloat<DVec2> for Offset
Source§fn try_conv_trunc(x: DVec2) -> Result<Self>
fn try_conv_trunc(x: DVec2) -> Result<Self>
Try converting to integer with truncation Read more
Source§fn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Convert to integer with truncatation Read more
Source§fn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Convert to the nearest integer Read more
Source§fn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Convert the floor to an integer Read more
Source§impl ConvFloat<Vec2> for Offset
impl ConvFloat<Vec2> for Offset
Source§fn try_conv_trunc(x: Vec2) -> Result<Self>
fn try_conv_trunc(x: Vec2) -> Result<Self>
Try converting to integer with truncation Read more
Source§fn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Convert to integer with truncatation Read more
Source§fn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Convert to the nearest integer Read more
Source§fn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Convert the floor to an integer Read more
Source§impl<'de> Deserialize<'de> for Offset
impl<'de> Deserialize<'de> for Offset
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl SubAssign<Offset> for Coord
impl SubAssign<Offset> for Coord
Source§fn sub_assign(&mut self, rhs: Offset)
fn sub_assign(&mut self, rhs: Offset)
Performs the
-=
operation. Read moreSource§impl SubAssign<Offset> for Rect
impl SubAssign<Offset> for Rect
Source§fn sub_assign(&mut self, offset: Offset)
fn sub_assign(&mut self, offset: Offset)
Performs the
-=
operation. Read moreSource§impl SubAssign for Offset
impl SubAssign for Offset
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl Copy for Offset
impl Eq for Offset
impl StructuralPartialEq for Offset
Auto Trait Implementations§
impl Freeze for Offset
impl RefUnwindSafe for Offset
impl Send for Offset
impl Sync for Offset
impl Unpin for Offset
impl UnwindSafe for Offset
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<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
impl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
Source§fn try_conv_approx(x: S) -> Result<T, Error>
fn try_conv_approx(x: S) -> Result<T, Error>
Source§fn conv_approx(x: S) -> T
fn conv_approx(x: S) -> T
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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()
.