diff options
Diffstat (limited to 'evc/src/helpers/vector.rs')
-rw-r--r-- | evc/src/helpers/vector.rs | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/evc/src/helpers/vector.rs b/evc/src/helpers/vector.rs index 9e7369e..4daa849 100644 --- a/evc/src/helpers/vector.rs +++ b/evc/src/helpers/vector.rs @@ -1,5 +1,3 @@ -use crate::ser::{Ser, Sink, Source}; - #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct Vec2<T> { pub x: T, @@ -26,32 +24,6 @@ impl<T: std::ops::Div<Output = T> + Copy> Vec2<T> { } } -impl Ser for Vec2<isize> { - fn write(&self, sink: &mut impl std::io::Write) -> anyhow::Result<()> { - sink.put((self.x, self.y)) - } - - fn read(source: &mut impl std::io::Read) -> anyhow::Result<Self> { - let (x, y) = source.get()?; - Ok(Vec2 { x, y }) - } -} - -pub struct Small<T>(pub T); -impl Ser for Small<Vec2<isize>> { - fn write(&self, sink: &mut impl std::io::Write) -> anyhow::Result<()> { - sink.put((self.0.x as i8, self.0.y as i8)) - } - - fn read(source: &mut impl std::io::Read) -> anyhow::Result<Self> { - let (x, y): (i8, i8) = source.get()?; - Ok(Small(Vec2 { - x: x as isize, - y: y as isize, - })) - } -} - impl<T: std::ops::Add> std::ops::Add for Vec2<T> { type Output = Vec2<T::Output>; #[inline] @@ -89,4 +61,3 @@ impl<T> From<(T, T)> for Vec2<T> { Vec2 { x, y } } } - |