From 8ca219c6b0d5448fd4529713ccd093e89de4e252 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 7 Dec 2022 17:55:27 +0100 Subject: refactor --- evc/src/helpers/vector.rs | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'evc/src/helpers/vector.rs') 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 { pub x: T, @@ -26,32 +24,6 @@ impl + Copy> Vec2 { } } -impl Ser for Vec2 { - 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 { - let (x, y) = source.get()?; - Ok(Vec2 { x, y }) - } -} - -pub struct Small(pub T); -impl Ser for Small> { - 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 { - let (x, y): (i8, i8) = source.get()?; - Ok(Small(Vec2 { - x: x as isize, - y: y as isize, - })) - } -} - impl std::ops::Add for Vec2 { type Output = Vec2; #[inline] @@ -89,4 +61,3 @@ impl From<(T, T)> for Vec2 { Vec2 { x, y } } } - -- cgit v1.2.3-70-g09d2