Implement division operation for Rectangle, Size and Vector
This commit is contained in:
parent
5195a59e20
commit
6f9b7a9005
3 changed files with 54 additions and 0 deletions
|
|
@ -64,6 +64,17 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> std::ops::Div<T> for Vector<T>
|
||||
where
|
||||
T: std::ops::Div<Output = T> + Copy,
|
||||
{
|
||||
type Output = Self;
|
||||
|
||||
fn div(self, scale: T) -> Self {
|
||||
Self::new(self.x / scale, self.y / scale)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Default for Vector<T>
|
||||
where
|
||||
T: Default,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue