Trait Serializer

Source
pub trait Serializer<'a, T>
where Self: 'a,
{ // Required methods fn accept_cell_visitor<V: CellVisitor>(&self, value: &T, visitor: &mut V); fn accept_column_visitor<V: ColumnVisitor>(&self, visitor: &mut V); // Provided methods fn to_row(&self, value: &T) -> BTreeMap<String, CellValue> { ... } fn to_json(&self, value: &T) -> Value { ... } fn columns(&self) -> Vec<String> { ... } }
Available on crate feature row only.
Expand description

A converter that visits rows of Django output for a given type.

This is suitable for the top level of Django output; i.e. things whose collection has its own endpoint.

Required Methods§

Source

fn accept_cell_visitor<V: CellVisitor>(&self, value: &T, visitor: &mut V)

Visit the values in a row of output for this type using visitor.

Source

fn accept_column_visitor<V: ColumnVisitor>(&self, visitor: &mut V)

Visit the columns in a row using visitor; note that this does not require an instance of the type.

Provided Methods§

Source

fn to_row(&self, value: &T) -> BTreeMap<String, CellValue>

Convert an instance of this type into a BTreeMap.

Source

fn to_json(&self, value: &T) -> Value

Convert an instance of this type into a serde_json::Value

Source

fn columns(&self) -> Vec<String>

Collect the columns for a table of this type into an ordered sequence.

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.

Implementors§