File size: 524 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | use postcard::ser_flavors::Flavor;
use crate::trace_writer::WriteGuard;
pub struct WriteGuardFlavor<'l> {
pub guard: WriteGuard<'l>,
}
impl Flavor for WriteGuardFlavor<'_> {
type Output = ();
fn try_push(&mut self, data: u8) -> postcard::Result<()> {
self.guard.push(data);
Ok(())
}
fn finalize(self) -> postcard::Result<Self::Output> {
Ok(())
}
fn try_extend(&mut self, data: &[u8]) -> postcard::Result<()> {
self.guard.extend(data);
Ok(())
}
}
|