Skip to main content

Serializer

Trait Serializer 

Source
pub trait Serializer: Plugin {
    // Required methods
    fn format(&self) -> &str;
    fn export(
        &self,
        data: &[HashMap<String, PropertyValue>],
    ) -> Result<Vec<u8>, CypherLiteError>;
    fn import(
        &self,
        bytes: &[u8],
    ) -> Result<Vec<HashMap<String, PropertyValue>>, CypherLiteError>;
}
Expand description

A custom serialization format for import/export operations.

Uses HashMap<String, PropertyValue> as the row representation to avoid a circular dependency on the query crate’s Row type.

Required Methods§

Source

fn format(&self) -> &str

Returns the format identifier (e.g. "json", "csv").

Source

fn export( &self, data: &[HashMap<String, PropertyValue>], ) -> Result<Vec<u8>, CypherLiteError>

Serialize a slice of rows into bytes.

Source

fn import( &self, bytes: &[u8], ) -> Result<Vec<HashMap<String, PropertyValue>>, CypherLiteError>

Deserialize bytes into a vector of rows.

Implementors§