Skip to main content

StoreSerializer

Trait StoreSerializer 

Source
pub trait StoreSerializer {
    // Required methods
    fn serialize_to_json(&self) -> Result<String, String>;
    fn deserialize_from_json(
        json: &str,
    ) -> Result<HashMap<String, Entry>, String>;
    fn serialize_entry_to_json(entry: &Entry) -> Result<String, String>;
    fn deserialize_entry_from_json(json: &str) -> Result<Entry, String>;
}
Expand description

Serialization utilities for KvStore

Required Methods§

Source

fn serialize_to_json(&self) -> Result<String, String>

Serialize the entire store to a JSON string

Source

fn deserialize_from_json(json: &str) -> Result<HashMap<String, Entry>, String>

Deserialize the entire store from a JSON string

Source

fn serialize_entry_to_json(entry: &Entry) -> Result<String, String>

Serialize a single entry to JSON

Source

fn deserialize_entry_from_json(json: &str) -> Result<Entry, String>

Deserialize a single entry from JSON

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl StoreSerializer for HashMap<String, Entry>

Default implementation for serialization

Implementors§