mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2025-06-11 10:53:19 +02:00
Implement first draft of raw write serverside
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
use std::fmt::{Debug, Display, Formatter};
|
||||
use std::{fmt, hash::Hasher};
|
||||
use std::fmt;
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
@ -20,6 +19,16 @@ pub mod value;
|
||||
#[archive_attr(derive(Debug))]
|
||||
pub struct State {
|
||||
pub inner: MachineState,
|
||||
pub raw: Vec<u8>,
|
||||
}
|
||||
impl State {
|
||||
pub fn new(inner: MachineState) -> Self {
|
||||
Self::with_raw(inner, Vec::new())
|
||||
}
|
||||
|
||||
pub fn with_raw(inner: MachineState, raw: Vec<u8>) -> Self {
|
||||
Self { inner, raw }
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for State {
|
||||
@ -34,8 +43,8 @@ impl fmt::Debug for State {
|
||||
}
|
||||
|
||||
impl fmt::Display for ArchivedState {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
Display::fmt(&self.inner, f)
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(&self.inner, f)
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +71,7 @@ struct StateVisitor;
|
||||
impl<'de> serde::de::Visitor<'de> for StateVisitor {
|
||||
type Value = State;
|
||||
|
||||
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a map from OIDs to value objects")
|
||||
}
|
||||
|
||||
@ -75,7 +84,7 @@ impl<'de> serde::de::Visitor<'de> for StateVisitor {
|
||||
));
|
||||
}
|
||||
let val: MachineState = map.next_value()?;
|
||||
Ok(State { inner: val })
|
||||
Ok(State { inner: val, raw: Vec::new() })
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user