mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
Use Self everywhere (#3787)
This turns on the clippy lint [`clippy::use_self`](https://rust-lang.github.io/rust-clippy/v0.0.212/index.html#use_self) and fixes it everywhere.
This commit is contained in:
@@ -141,15 +141,15 @@ impl Align {
|
||||
pub struct Align2(pub [Align; 2]);
|
||||
|
||||
impl Align2 {
|
||||
pub const LEFT_BOTTOM: Align2 = Align2([Align::Min, Align::Max]);
|
||||
pub const LEFT_CENTER: Align2 = Align2([Align::Min, Align::Center]);
|
||||
pub const LEFT_TOP: Align2 = Align2([Align::Min, Align::Min]);
|
||||
pub const CENTER_BOTTOM: Align2 = Align2([Align::Center, Align::Max]);
|
||||
pub const CENTER_CENTER: Align2 = Align2([Align::Center, Align::Center]);
|
||||
pub const CENTER_TOP: Align2 = Align2([Align::Center, Align::Min]);
|
||||
pub const RIGHT_BOTTOM: Align2 = Align2([Align::Max, Align::Max]);
|
||||
pub const RIGHT_CENTER: Align2 = Align2([Align::Max, Align::Center]);
|
||||
pub const RIGHT_TOP: Align2 = Align2([Align::Max, Align::Min]);
|
||||
pub const LEFT_BOTTOM: Self = Self([Align::Min, Align::Max]);
|
||||
pub const LEFT_CENTER: Self = Self([Align::Min, Align::Center]);
|
||||
pub const LEFT_TOP: Self = Self([Align::Min, Align::Min]);
|
||||
pub const CENTER_BOTTOM: Self = Self([Align::Center, Align::Max]);
|
||||
pub const CENTER_CENTER: Self = Self([Align::Center, Align::Center]);
|
||||
pub const CENTER_TOP: Self = Self([Align::Center, Align::Min]);
|
||||
pub const RIGHT_BOTTOM: Self = Self([Align::Max, Align::Max]);
|
||||
pub const RIGHT_CENTER: Self = Self([Align::Max, Align::Center]);
|
||||
pub const RIGHT_TOP: Self = Self([Align::Max, Align::Min]);
|
||||
}
|
||||
|
||||
impl Align2 {
|
||||
|
||||
@@ -190,8 +190,8 @@ impl Pos2 {
|
||||
}
|
||||
|
||||
/// Linearly interpolate towards another point, so that `0.0 => self, 1.0 => other`.
|
||||
pub fn lerp(&self, other: Pos2, t: f32) -> Pos2 {
|
||||
Pos2 {
|
||||
pub fn lerp(&self, other: Self, t: f32) -> Self {
|
||||
Self {
|
||||
x: lerp(self.x..=other.x, t),
|
||||
y: lerp(self.y..=other.y, t),
|
||||
}
|
||||
@@ -227,7 +227,7 @@ impl Eq for Pos2 {}
|
||||
impl AddAssign<Vec2> for Pos2 {
|
||||
#[inline(always)]
|
||||
fn add_assign(&mut self, rhs: Vec2) {
|
||||
*self = Pos2 {
|
||||
*self = Self {
|
||||
x: self.x + rhs.x,
|
||||
y: self.y + rhs.y,
|
||||
};
|
||||
@@ -237,7 +237,7 @@ impl AddAssign<Vec2> for Pos2 {
|
||||
impl SubAssign<Vec2> for Pos2 {
|
||||
#[inline(always)]
|
||||
fn sub_assign(&mut self, rhs: Vec2) {
|
||||
*self = Pos2 {
|
||||
*self = Self {
|
||||
x: self.x - rhs.x,
|
||||
y: self.y - rhs.y,
|
||||
};
|
||||
@@ -245,11 +245,11 @@ impl SubAssign<Vec2> for Pos2 {
|
||||
}
|
||||
|
||||
impl Add<Vec2> for Pos2 {
|
||||
type Output = Pos2;
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn add(self, rhs: Vec2) -> Pos2 {
|
||||
Pos2 {
|
||||
fn add(self, rhs: Vec2) -> Self {
|
||||
Self {
|
||||
x: self.x + rhs.x,
|
||||
y: self.y + rhs.y,
|
||||
}
|
||||
@@ -260,7 +260,7 @@ impl Sub for Pos2 {
|
||||
type Output = Vec2;
|
||||
|
||||
#[inline(always)]
|
||||
fn sub(self, rhs: Pos2) -> Vec2 {
|
||||
fn sub(self, rhs: Self) -> Vec2 {
|
||||
Vec2 {
|
||||
x: self.x - rhs.x,
|
||||
y: self.y - rhs.y,
|
||||
@@ -269,11 +269,11 @@ impl Sub for Pos2 {
|
||||
}
|
||||
|
||||
impl Sub<Vec2> for Pos2 {
|
||||
type Output = Pos2;
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn sub(self, rhs: Vec2) -> Pos2 {
|
||||
Pos2 {
|
||||
fn sub(self, rhs: Vec2) -> Self {
|
||||
Self {
|
||||
x: self.x - rhs.x,
|
||||
y: self.y - rhs.y,
|
||||
}
|
||||
@@ -281,11 +281,11 @@ impl Sub<Vec2> for Pos2 {
|
||||
}
|
||||
|
||||
impl Mul<f32> for Pos2 {
|
||||
type Output = Pos2;
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn mul(self, factor: f32) -> Pos2 {
|
||||
Pos2 {
|
||||
fn mul(self, factor: f32) -> Self {
|
||||
Self {
|
||||
x: self.x * factor,
|
||||
y: self.y * factor,
|
||||
}
|
||||
@@ -305,11 +305,11 @@ impl Mul<Pos2> for f32 {
|
||||
}
|
||||
|
||||
impl Div<f32> for Pos2 {
|
||||
type Output = Pos2;
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn div(self, factor: f32) -> Pos2 {
|
||||
Pos2 {
|
||||
fn div(self, factor: f32) -> Self {
|
||||
Self {
|
||||
x: self.x / factor,
|
||||
y: self.y / factor,
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ impl Rangef {
|
||||
/// Flip `min` and `max` if needed, so that `min <= max` after.
|
||||
#[inline]
|
||||
pub fn as_positive(self) -> Self {
|
||||
Rangef {
|
||||
Self {
|
||||
min: self.min.min(self.max),
|
||||
max: self.min.max(self.max),
|
||||
}
|
||||
|
||||
@@ -70,13 +70,13 @@ impl Rect {
|
||||
|
||||
#[inline(always)]
|
||||
pub const fn from_min_max(min: Pos2, max: Pos2) -> Self {
|
||||
Rect { min, max }
|
||||
Self { min, max }
|
||||
}
|
||||
|
||||
/// left-top corner plus a size (stretching right-down).
|
||||
#[inline(always)]
|
||||
pub fn from_min_size(min: Pos2, size: Vec2) -> Self {
|
||||
Rect {
|
||||
Self {
|
||||
min,
|
||||
max: min + size,
|
||||
}
|
||||
@@ -84,7 +84,7 @@ impl Rect {
|
||||
|
||||
#[inline(always)]
|
||||
pub fn from_center_size(center: Pos2, size: Vec2) -> Self {
|
||||
Rect {
|
||||
Self {
|
||||
min: center - size * 0.5,
|
||||
max: center + size * 0.5,
|
||||
}
|
||||
@@ -94,7 +94,7 @@ impl Rect {
|
||||
pub fn from_x_y_ranges(x_range: impl Into<Rangef>, y_range: impl Into<Rangef>) -> Self {
|
||||
let x_range = x_range.into();
|
||||
let y_range = y_range.into();
|
||||
Rect {
|
||||
Self {
|
||||
min: pos2(x_range.min, y_range.min),
|
||||
max: pos2(x_range.max, y_range.max),
|
||||
}
|
||||
@@ -103,7 +103,7 @@ impl Rect {
|
||||
/// Returns the bounding rectangle of the two points.
|
||||
#[inline]
|
||||
pub fn from_two_pos(a: Pos2, b: Pos2) -> Self {
|
||||
Rect {
|
||||
Self {
|
||||
min: pos2(a.x.min(b.x), a.y.min(b.y)),
|
||||
max: pos2(a.x.max(b.x), a.y.max(b.y)),
|
||||
}
|
||||
@@ -111,7 +111,7 @@ impl Rect {
|
||||
|
||||
/// Bounding-box around the points.
|
||||
pub fn from_points(points: &[Pos2]) -> Self {
|
||||
let mut rect = Rect::NOTHING;
|
||||
let mut rect = Self::NOTHING;
|
||||
for &p in points {
|
||||
rect.extend_with(p);
|
||||
}
|
||||
@@ -187,7 +187,7 @@ impl Rect {
|
||||
/// Expand by this much in each direction, keeping the center
|
||||
#[must_use]
|
||||
pub fn expand2(self, amnt: Vec2) -> Self {
|
||||
Rect::from_min_max(self.min - amnt, self.max + amnt)
|
||||
Self::from_min_max(self.min - amnt, self.max + amnt)
|
||||
}
|
||||
|
||||
/// Shrink by this much in each direction, keeping the center
|
||||
@@ -199,13 +199,13 @@ impl Rect {
|
||||
/// Shrink by this much in each direction, keeping the center
|
||||
#[must_use]
|
||||
pub fn shrink2(self, amnt: Vec2) -> Self {
|
||||
Rect::from_min_max(self.min + amnt, self.max - amnt)
|
||||
Self::from_min_max(self.min + amnt, self.max - amnt)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub fn translate(self, amnt: Vec2) -> Self {
|
||||
Rect::from_min_size(self.min + amnt, self.size())
|
||||
Self::from_min_size(self.min + amnt, self.size())
|
||||
}
|
||||
|
||||
/// Rotate the bounds (will expand the [`Rect`])
|
||||
@@ -225,7 +225,7 @@ impl Rect {
|
||||
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub fn intersects(self, other: Rect) -> bool {
|
||||
pub fn intersects(self, other: Self) -> bool {
|
||||
self.min.x <= other.max.x
|
||||
&& other.min.x <= self.max.x
|
||||
&& self.min.y <= other.max.y
|
||||
@@ -254,7 +254,7 @@ impl Rect {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn contains_rect(&self, other: Rect) -> bool {
|
||||
pub fn contains_rect(&self, other: Self) -> bool {
|
||||
self.contains(other.min) && self.contains(other.max)
|
||||
}
|
||||
|
||||
@@ -289,8 +289,8 @@ impl Rect {
|
||||
/// that contains both input rectangles.
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn union(self, other: Rect) -> Rect {
|
||||
Rect {
|
||||
pub fn union(self, other: Self) -> Self {
|
||||
Self {
|
||||
min: self.min.min(other.min),
|
||||
max: self.max.max(other.max),
|
||||
}
|
||||
@@ -299,7 +299,7 @@ impl Rect {
|
||||
/// The intersection of two [`Rect`], i.e. the area covered by both.
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn intersect(self, other: Rect) -> Self {
|
||||
pub fn intersect(self, other: Self) -> Self {
|
||||
Self {
|
||||
min: self.min.max(other.min),
|
||||
max: self.max.min(other.max),
|
||||
@@ -419,7 +419,7 @@ impl Rect {
|
||||
|
||||
/// Linearly self towards other rect.
|
||||
#[inline]
|
||||
pub fn lerp_towards(&self, other: &Rect, t: f32) -> Self {
|
||||
pub fn lerp_towards(&self, other: &Self, t: f32) -> Self {
|
||||
Self {
|
||||
min: self.min.lerp(other.min, t),
|
||||
max: self.max.lerp(other.max, t),
|
||||
@@ -581,26 +581,26 @@ impl Rect {
|
||||
}
|
||||
|
||||
/// Split rectangle in left and right halves. `t` is expected to be in the (0,1) range.
|
||||
pub fn split_left_right_at_fraction(&self, t: f32) -> (Rect, Rect) {
|
||||
pub fn split_left_right_at_fraction(&self, t: f32) -> (Self, Self) {
|
||||
self.split_left_right_at_x(lerp(self.min.x..=self.max.x, t))
|
||||
}
|
||||
|
||||
/// Split rectangle in left and right halves at the given `x` coordinate.
|
||||
pub fn split_left_right_at_x(&self, split_x: f32) -> (Rect, Rect) {
|
||||
let left = Rect::from_min_max(self.min, Pos2::new(split_x, self.max.y));
|
||||
let right = Rect::from_min_max(Pos2::new(split_x, self.min.y), self.max);
|
||||
pub fn split_left_right_at_x(&self, split_x: f32) -> (Self, Self) {
|
||||
let left = Self::from_min_max(self.min, Pos2::new(split_x, self.max.y));
|
||||
let right = Self::from_min_max(Pos2::new(split_x, self.min.y), self.max);
|
||||
(left, right)
|
||||
}
|
||||
|
||||
/// Split rectangle in top and bottom halves. `t` is expected to be in the (0,1) range.
|
||||
pub fn split_top_bottom_at_fraction(&self, t: f32) -> (Rect, Rect) {
|
||||
pub fn split_top_bottom_at_fraction(&self, t: f32) -> (Self, Self) {
|
||||
self.split_top_bottom_at_y(lerp(self.min.y..=self.max.y, t))
|
||||
}
|
||||
|
||||
/// Split rectangle in top and bottom halves at the given `y` coordinate.
|
||||
pub fn split_top_bottom_at_y(&self, split_y: f32) -> (Rect, Rect) {
|
||||
let top = Rect::from_min_max(self.min, Pos2::new(self.max.x, split_y));
|
||||
let bottom = Rect::from_min_max(Pos2::new(self.min.x, split_y), self.max);
|
||||
pub fn split_top_bottom_at_y(&self, split_y: f32) -> (Self, Self) {
|
||||
let top = Self::from_min_max(self.min, Pos2::new(self.max.x, split_y));
|
||||
let bottom = Self::from_min_max(Pos2::new(self.min.x, split_y), self.max);
|
||||
(top, bottom)
|
||||
}
|
||||
}
|
||||
@@ -620,11 +620,11 @@ impl From<[Pos2; 2]> for Rect {
|
||||
}
|
||||
|
||||
impl Mul<f32> for Rect {
|
||||
type Output = Rect;
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
fn mul(self, factor: f32) -> Rect {
|
||||
Rect {
|
||||
fn mul(self, factor: f32) -> Self {
|
||||
Self {
|
||||
min: self.min * factor,
|
||||
max: self.max * factor,
|
||||
}
|
||||
@@ -644,11 +644,11 @@ impl Mul<Rect> for f32 {
|
||||
}
|
||||
|
||||
impl Div<f32> for Rect {
|
||||
type Output = Rect;
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
fn div(self, factor: f32) -> Rect {
|
||||
Rect {
|
||||
fn div(self, factor: f32) -> Self {
|
||||
Self {
|
||||
min: self.min / factor,
|
||||
max: self.max / factor,
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ impl RectTransform {
|
||||
self.to.size() / self.from.size()
|
||||
}
|
||||
|
||||
pub fn inverse(&self) -> RectTransform {
|
||||
pub fn inverse(&self) -> Self {
|
||||
Self::from_to(self.to, self.from)
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ impl Rot2 {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn inverse(self) -> Rot2 {
|
||||
pub fn inverse(self) -> Self {
|
||||
Self {
|
||||
s: -self.s,
|
||||
c: self.c,
|
||||
@@ -92,15 +92,15 @@ impl std::fmt::Debug for Rot2 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Mul<Rot2> for Rot2 {
|
||||
type Output = Rot2;
|
||||
impl std::ops::Mul<Self> for Rot2 {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, r: Rot2) -> Rot2 {
|
||||
fn mul(self, r: Self) -> Self {
|
||||
/*
|
||||
|lc -ls| * |rc -rs|
|
||||
|ls lc| |rs rc|
|
||||
*/
|
||||
Rot2 {
|
||||
Self {
|
||||
c: self.c * r.c - self.s * r.s,
|
||||
s: self.s * r.c + self.c * r.s,
|
||||
}
|
||||
@@ -133,10 +133,10 @@ impl std::ops::Mul<Rot2> for f32 {
|
||||
|
||||
/// Scales the rotor.
|
||||
impl std::ops::Mul<f32> for Rot2 {
|
||||
type Output = Rot2;
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, r: f32) -> Rot2 {
|
||||
Rot2 {
|
||||
fn mul(self, r: f32) -> Self {
|
||||
Self {
|
||||
c: self.c * r,
|
||||
s: self.s * r,
|
||||
}
|
||||
@@ -145,10 +145,10 @@ impl std::ops::Mul<f32> for Rot2 {
|
||||
|
||||
/// Scales the rotor.
|
||||
impl std::ops::Div<f32> for Rot2 {
|
||||
type Output = Rot2;
|
||||
type Output = Self;
|
||||
|
||||
fn div(self, r: f32) -> Rot2 {
|
||||
Rot2 {
|
||||
fn div(self, r: f32) -> Self {
|
||||
Self {
|
||||
c: self.c / r,
|
||||
s: self.s / r,
|
||||
}
|
||||
|
||||
@@ -108,13 +108,13 @@ impl From<Vec2> for mint::Vector2<f32> {
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
impl Vec2 {
|
||||
pub const X: Vec2 = Vec2 { x: 1.0, y: 0.0 };
|
||||
pub const Y: Vec2 = Vec2 { x: 0.0, y: 1.0 };
|
||||
pub const X: Self = Self { x: 1.0, y: 0.0 };
|
||||
pub const Y: Self = Self { x: 0.0, y: 1.0 };
|
||||
|
||||
pub const RIGHT: Vec2 = Vec2 { x: 1.0, y: 0.0 };
|
||||
pub const LEFT: Vec2 = Vec2 { x: -1.0, y: 0.0 };
|
||||
pub const UP: Vec2 = Vec2 { x: 0.0, y: -1.0 };
|
||||
pub const DOWN: Vec2 = Vec2 { x: 0.0, y: 1.0 };
|
||||
pub const RIGHT: Self = Self { x: 1.0, y: 0.0 };
|
||||
pub const LEFT: Self = Self { x: -1.0, y: 0.0 };
|
||||
pub const UP: Self = Self { x: 0.0, y: -1.0 };
|
||||
pub const DOWN: Self = Self { x: 0.0, y: 1.0 };
|
||||
|
||||
pub const ZERO: Self = Self { x: 0.0, y: 0.0 };
|
||||
pub const INFINITY: Self = Self::splat(f32::INFINITY);
|
||||
@@ -278,8 +278,8 @@ impl Vec2 {
|
||||
/// Swizzle the axes.
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn yx(self) -> Vec2 {
|
||||
Vec2 {
|
||||
pub fn yx(self) -> Self {
|
||||
Self {
|
||||
x: self.y,
|
||||
y: self.x,
|
||||
}
|
||||
@@ -322,18 +322,18 @@ impl std::ops::IndexMut<usize> for Vec2 {
|
||||
impl Eq for Vec2 {}
|
||||
|
||||
impl Neg for Vec2 {
|
||||
type Output = Vec2;
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn neg(self) -> Vec2 {
|
||||
fn neg(self) -> Self {
|
||||
vec2(-self.x, -self.y)
|
||||
}
|
||||
}
|
||||
|
||||
impl AddAssign for Vec2 {
|
||||
#[inline(always)]
|
||||
fn add_assign(&mut self, rhs: Vec2) {
|
||||
*self = Vec2 {
|
||||
fn add_assign(&mut self, rhs: Self) {
|
||||
*self = Self {
|
||||
x: self.x + rhs.x,
|
||||
y: self.y + rhs.y,
|
||||
};
|
||||
@@ -342,8 +342,8 @@ impl AddAssign for Vec2 {
|
||||
|
||||
impl SubAssign for Vec2 {
|
||||
#[inline(always)]
|
||||
fn sub_assign(&mut self, rhs: Vec2) {
|
||||
*self = Vec2 {
|
||||
fn sub_assign(&mut self, rhs: Self) {
|
||||
*self = Self {
|
||||
x: self.x - rhs.x,
|
||||
y: self.y - rhs.y,
|
||||
};
|
||||
@@ -351,11 +351,11 @@ impl SubAssign for Vec2 {
|
||||
}
|
||||
|
||||
impl Add for Vec2 {
|
||||
type Output = Vec2;
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn add(self, rhs: Vec2) -> Vec2 {
|
||||
Vec2 {
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
Self {
|
||||
x: self.x + rhs.x,
|
||||
y: self.y + rhs.y,
|
||||
}
|
||||
@@ -363,11 +363,11 @@ impl Add for Vec2 {
|
||||
}
|
||||
|
||||
impl Sub for Vec2 {
|
||||
type Output = Vec2;
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn sub(self, rhs: Vec2) -> Vec2 {
|
||||
Vec2 {
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
Self {
|
||||
x: self.x - rhs.x,
|
||||
y: self.y - rhs.y,
|
||||
}
|
||||
@@ -375,12 +375,12 @@ impl Sub for Vec2 {
|
||||
}
|
||||
|
||||
/// Element-wise multiplication
|
||||
impl Mul<Vec2> for Vec2 {
|
||||
type Output = Vec2;
|
||||
impl Mul<Self> for Vec2 {
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn mul(self, vec: Vec2) -> Vec2 {
|
||||
Vec2 {
|
||||
fn mul(self, vec: Self) -> Self {
|
||||
Self {
|
||||
x: self.x * vec.x,
|
||||
y: self.y * vec.y,
|
||||
}
|
||||
@@ -388,12 +388,12 @@ impl Mul<Vec2> for Vec2 {
|
||||
}
|
||||
|
||||
/// Element-wise division
|
||||
impl Div<Vec2> for Vec2 {
|
||||
type Output = Vec2;
|
||||
impl Div<Self> for Vec2 {
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn div(self, rhs: Vec2) -> Vec2 {
|
||||
Vec2 {
|
||||
fn div(self, rhs: Self) -> Self {
|
||||
Self {
|
||||
x: self.x / rhs.x,
|
||||
y: self.y / rhs.y,
|
||||
}
|
||||
@@ -417,11 +417,11 @@ impl DivAssign<f32> for Vec2 {
|
||||
}
|
||||
|
||||
impl Mul<f32> for Vec2 {
|
||||
type Output = Vec2;
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn mul(self, factor: f32) -> Vec2 {
|
||||
Vec2 {
|
||||
fn mul(self, factor: f32) -> Self {
|
||||
Self {
|
||||
x: self.x * factor,
|
||||
y: self.y * factor,
|
||||
}
|
||||
@@ -441,11 +441,11 @@ impl Mul<Vec2> for f32 {
|
||||
}
|
||||
|
||||
impl Div<f32> for Vec2 {
|
||||
type Output = Vec2;
|
||||
type Output = Self;
|
||||
|
||||
#[inline(always)]
|
||||
fn div(self, factor: f32) -> Vec2 {
|
||||
Vec2 {
|
||||
fn div(self, factor: f32) -> Self {
|
||||
Self {
|
||||
x: self.x / factor,
|
||||
y: self.y / factor,
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ impl Vec2b {
|
||||
impl From<bool> for Vec2b {
|
||||
#[inline]
|
||||
fn from(val: bool) -> Self {
|
||||
Vec2b { x: val, y: val }
|
||||
Self { x: val, y: val }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<[bool; 2]> for Vec2b {
|
||||
#[inline]
|
||||
fn from([x, y]: [bool; 2]) -> Self {
|
||||
Vec2b { x, y }
|
||||
Self { x, y }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user