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§
Sourcefn accept_cell_visitor<V: CellVisitor>(&self, value: &T, visitor: &mut V)
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
.
Sourcefn accept_column_visitor<V: ColumnVisitor>(&self, visitor: &mut V)
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§
Sourcefn to_row(&self, value: &T) -> BTreeMap<String, CellValue>
fn to_row(&self, value: &T) -> BTreeMap<String, CellValue>
Convert an instance of this type into a BTreeMap
.
Sourcefn to_json(&self, value: &T) -> Value
fn to_json(&self, value: &T) -> Value
Convert an instance of this type into a serde_json::Value
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.