Apply suggestions

This commit is contained in:
Jakub Hlusička 2020-10-29 14:50:17 +01:00
parent 9090fa6a22
commit 16646ffc41
No known key found for this signature in database
GPG Key ID: 1FBD447C66706697
2 changed files with 7 additions and 9 deletions

View File

@ -1,4 +1,4 @@
use super::vector::Vector;
use crate::Vector;
use std::f32;
/// An amount of space in 2 dimensions.
@ -72,3 +72,9 @@ impl From<Size> for [f32; 2] {
[size.width, size.height]
}
}
impl From<Size> for Vector<f32> {
fn from(size: Size) -> Self {
Vector::new(size.width, size.height)
}
}

View File

@ -1,5 +1,3 @@
use super::size::Size;
/// A 2D vector.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Vector<T = f32> {
@ -82,9 +80,3 @@ where
[other.x, other.y]
}
}
impl From<Size> for Vector<f32> {
fn from(size: Size) -> Self {
Vector::new(size.width, size.height)
}
}