use crate::{Bivector, Rotor, Vector}; use data_stream::{from_stream, numbers::EndianSettings, to_stream, FromStream, ToStream}; use std::io::{Read, Result, Write}; impl> ToStream for Vector { fn to_stream(&self, writer: &mut W) -> Result<()> { to_stream(&self.x, writer)?; to_stream(&self.y, writer)?; Ok(()) } } impl> FromStream for Vector { fn from_stream(reader: &mut R) -> Result { Ok(Self { x: from_stream(reader)?, y: from_stream(reader)?, }) } } impl> ToStream for Bivector { fn to_stream(&self, writer: &mut W) -> Result<()> { to_stream(&self.xy, writer)?; Ok(()) } } impl> FromStream for Bivector { fn from_stream(reader: &mut R) -> Result { Ok(Self { xy: from_stream(reader)?, }) } } impl> ToStream for Rotor { fn to_stream(&self, writer: &mut W) -> Result<()> { to_stream(&self.scalar, writer)?; to_stream(&self.xy, writer)?; Ok(()) } } impl> FromStream for Rotor { fn from_stream(reader: &mut R) -> Result { Ok(Self { scalar: from_stream(reader)?, xy: from_stream(reader)?, }) } }