tauri_store/store/marshaler/
mod.rs1mod json;
2
3#[cfg(feature = "marshaler-toml")]
4mod toml;
5
6use crate::store::StoreState;
7
8pub use json::{JsonMarshaler, PrettyJsonMarshaler};
9
10#[cfg(feature = "marshaler-toml")]
11pub use toml::{PrettyTomlMarshaler, TomlMarshaler};
12
13pub type MarshalingError = Box<dyn std::error::Error + Send + Sync>;
15
16pub trait Marshaler: Send + Sync {
18 fn serialize(&self, state: &StoreState) -> Result<Vec<u8>, MarshalingError>;
19 fn deserialize(&self, bytes: &[u8]) -> Result<StoreState, MarshalingError>;
20
21 fn extension(&self) -> &'static str {
23 "store"
24 }
25}