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: Offset, max: Offset) -> Offset
pub fn clamp(self, min: Offset, max: Offset) -> Offset
Restrict a value to the specified interval, componentwise
sourcepub fn cwise_mul(self, rhs: Offset) -> Offset
pub fn cwise_mul(self, rhs: Offset) -> Offset
Return the result of component-wise multiplication
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>(self, dir: D) -> i32where
D: Directional,
pub fn extract<D>(self, dir: D) -> i32where
D: Directional,
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>(&mut self, dir: D, value: i32)where
D: Directional,
pub fn set_component<D>(&mut self, dir: D, value: i32)where
D: Directional,
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: Offset)
fn add_assign(&mut self, rhs: Offset)
Performs the
+=
operation. Read moresource§impl ConvApprox<DVec2> for Offset
impl ConvApprox<DVec2> for Offset
source§impl ConvApprox<Vec2> for Offset
impl ConvApprox<Vec2> for Offset
source§impl ConvFloat<DVec2> for Offset
impl ConvFloat<DVec2> for Offset
source§fn try_conv_trunc(x: DVec2) -> Result<Offset, Error>
fn try_conv_trunc(x: DVec2) -> Result<Offset, Error>
Try converting to integer with truncation Read more
source§fn try_conv_nearest(x: DVec2) -> Result<Offset, Error>
fn try_conv_nearest(x: DVec2) -> Result<Offset, Error>
Try converting to the nearest integer Read more
source§fn try_conv_floor(x: DVec2) -> Result<Offset, Error>
fn try_conv_floor(x: DVec2) -> Result<Offset, Error>
Try converting the floor to an integer Read more
source§fn try_conv_ceil(x: DVec2) -> Result<Offset, Error>
fn try_conv_ceil(x: DVec2) -> Result<Offset, Error>
Try convert the ceiling to an integer Read more
§fn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Convert to integer with truncatation Read more
§fn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Convert to the nearest integer Read more
§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<Offset, Error>
fn try_conv_trunc(x: Vec2) -> Result<Offset, Error>
Try converting to integer with truncation Read more
source§fn try_conv_nearest(x: Vec2) -> Result<Offset, Error>
fn try_conv_nearest(x: Vec2) -> Result<Offset, Error>
Try converting to the nearest integer Read more
source§fn try_conv_floor(x: Vec2) -> Result<Offset, Error>
fn try_conv_floor(x: Vec2) -> Result<Offset, Error>
Try converting the floor to an integer Read more
source§fn try_conv_ceil(x: Vec2) -> Result<Offset, Error>
fn try_conv_ceil(x: Vec2) -> Result<Offset, Error>
Try convert the ceiling to an integer Read more
§fn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Convert to integer with truncatation Read more
§fn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Convert to the nearest integer Read more
§fn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Convert the floor to an integer Read more
source§impl PartialEq for Offset
impl PartialEq for Offset
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: Offset)
fn sub_assign(&mut self, rhs: Offset)
Performs the
-=
operation. Read moreimpl Copy for Offset
impl Eq for Offset
impl StructuralEq for Offset
impl StructuralPartialEq for Offset
Auto Trait Implementations§
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
§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
§fn cast_approx(self) -> T
fn cast_approx(self) -> T
§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
§fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
§fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
§fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
§fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more
§impl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
impl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
§fn try_conv_approx(x: S) -> Result<T, Error>
fn try_conv_approx(x: S) -> Result<T, Error>
§fn conv_approx(x: S) -> T
fn conv_approx(x: S) -> T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§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()
.