Add validation for serialization format
Signed-off-by: trivernis <trivernis@protonmail.com>main
parent
a6c8ad8795
commit
3cb1aa0496
@ -1,10 +1,21 @@
|
||||
use crate::hydrus_serializable::{HydrusSerializable, SerializableId};
|
||||
use crate::hydrus_serializable::{ConstNumberTrait, HydrusSerializable, SerializableId};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct VersionOne;
|
||||
|
||||
impl ConstNumberTrait for VersionOne {
|
||||
fn value() -> u64 {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(bound = "")]
|
||||
pub struct HydrusSerWrapper<T: HydrusSerializable> {
|
||||
#[allow(unused)]
|
||||
pub type_id: SerializableId<T>,
|
||||
pub version: u8,
|
||||
#[allow(unused)]
|
||||
pub version: SerializableId<VersionOne>,
|
||||
pub inner: T,
|
||||
}
|
||||
|
Loading…
Reference in New Issue