Skip to main content

multilinear/
streams.rs

1use super::{Aspect, Event};
2
3use data_stream::{FromStream, ToStream, from_stream, numbers::EndianSettings, to_stream};
4
5use std::io::{Error, Read, Write};
6
7impl<S: EndianSettings> ToStream<S> for Event {
8    #[inline]
9    fn to_stream<W: Write>(&self, stream: &mut W) -> Result<(), Error> {
10        to_stream::<S, _, _>(&self.0, stream)
11    }
12}
13
14impl<S: EndianSettings> FromStream<S> for Event {
15    #[inline]
16    fn from_stream<R: Read>(stream: &mut R) -> Result<Self, Error> {
17        Ok(Self(from_stream::<S, _, _>(stream)?))
18    }
19}
20
21impl<S: EndianSettings> ToStream<S> for Aspect {
22    #[inline]
23    fn to_stream<W: Write>(&self, stream: &mut W) -> Result<(), Error> {
24        to_stream::<S, _, _>(&self.0, stream)
25    }
26}
27
28impl<S: EndianSettings> FromStream<S> for Aspect {
29    #[inline]
30    fn from_stream<R: Read>(stream: &mut R) -> Result<Self, Error> {
31        Ok(Self(from_stream::<S, _, _>(stream)?))
32    }
33}