diff options
author | metamuffin <metamuffin@disroot.org> | 2022-12-07 17:55:27 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-12-07 17:55:27 +0100 |
commit | 8ca219c6b0d5448fd4529713ccd093e89de4e252 (patch) | |
tree | 8fe02fd35ae337766d6f8e7533da170830162d14 /evc/src/helpers/vector.rs | |
parent | a99674b911cb9b2fa398ccf61830d5933ccaf931 (diff) | |
download | video-codec-experiments-8ca219c6b0d5448fd4529713ccd093e89de4e252.tar video-codec-experiments-8ca219c6b0d5448fd4529713ccd093e89de4e252.tar.bz2 video-codec-experiments-8ca219c6b0d5448fd4529713ccd093e89de4e252.tar.zst |
refactor
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 } } } - |