tauri_store/store/marshaler/
cbor.rs1use super::{Marshaler, MarshalingError};
2use crate::store::StoreState;
3use ciborium::de::from_reader;
4use ciborium::ser::into_writer;
5
6pub struct CborMarshaler;
8
9impl Marshaler for CborMarshaler {
10 fn serialize(&self, state: &StoreState) -> Result<Vec<u8>, MarshalingError> {
11 let mut buf = Vec::new();
12 into_writer(state, &mut buf)?;
13 Ok(buf)
14 }
15
16 fn deserialize(&self, bytes: &[u8]) -> Result<StoreState, MarshalingError> {
17 Ok(from_reader(bytes)?)
18 }
19}