Skip to content

Commit

Permalink
🔨 Rework Vec definition
Browse files Browse the repository at this point in the history
The `Vector*` and `Vec*` types were lacking on documentation, and on
`#[must_use]` attributes. This modifies all of the API to be be better
documented, and to include `#[must_use]` where possible.
  • Loading branch information
bitwizeshift committed Feb 6, 2024
1 parent 8da05a7 commit 5551c0f
Show file tree
Hide file tree
Showing 10 changed files with 1,498 additions and 210 deletions.
66 changes: 0 additions & 66 deletions alloy/src/math/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,69 +56,3 @@ pub use vec4::*;
pub use vec4i::*;
#[doc(inline)]
pub use vec4u::*;

impl From<&'_ Vec2i> for Vector2 {
#[inline]
fn from(value: &'_ Vec2i) -> Self {
Self {
x: value.x() as f32,
y: value.y() as f32,
}
}
}

impl From<&'_ Vec2u> for Vector2 {
#[inline]
fn from(value: &'_ Vec2u) -> Self {
Self {
x: value.x() as f32,
y: value.y() as f32,
}
}
}

impl From<&'_ Vec3i> for Vector3 {
#[inline]
fn from(value: &'_ Vec3i) -> Self {
Self {
x: value.x() as f32,
y: value.y() as f32,
z: value.z() as f32,
}
}
}

impl From<&'_ Vec3u> for Vector3 {
#[inline]
fn from(value: &'_ Vec3u) -> Self {
Self {
x: value.x() as f32,
y: value.y() as f32,
z: value.z() as f32,
}
}
}

impl From<&'_ Vec4i> for Vector4 {
#[inline]
fn from(value: &'_ Vec4i) -> Self {
Self {
x: value.x() as f32,
y: value.y() as f32,
z: value.z() as f32,
w: value.w() as f32,
}
}
}

impl From<&'_ Vec4u> for Vector4 {
#[inline]
fn from(value: &'_ Vec4u) -> Self {
Self {
x: value.x() as f32,
y: value.y() as f32,
z: value.z() as f32,
w: value.w() as f32,
}
}
}
Loading

0 comments on commit 5551c0f

Please sign in to comment.