Impl ScanData serialization in the DB

This commit is contained in:
Luke Parker
2024-08-30 00:11:00 -04:00
parent 41a74cb513
commit 775824f373
2 changed files with 85 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
use core::{marker::PhantomData, fmt::Debug};
use std::collections::HashMap;
use std::{io, collections::HashMap};
use group::GroupEncoding;
@@ -179,6 +179,19 @@ pub struct Return<S: ScannerFeed> {
output: OutputFor<S>,
}
impl<S: ScannerFeed> Return<S> {
pub(crate) fn write(&self, writer: &mut impl io::Write) -> io::Result<()> {
self.address.write(writer)?;
self.output.write(writer)
}
pub(crate) fn read(reader: &mut impl io::Read) -> io::Result<Self> {
let address = AddressFor::<S>::read(reader)?;
let output = OutputFor::<S>::read(reader)?;
Ok(Return { address, output })
}
}
/// An update for the scheduler.
pub struct SchedulerUpdate<S: ScannerFeed> {
outputs: Vec<OutputFor<S>>,