Skip to main content

AnySerializableVec

Trait AnySerializableVec 

Source
pub trait AnySerializableVec: AnyReadableVec {
    // Required methods
    fn write_json(
        &self,
        from: Option<usize>,
        to: Option<usize>,
        buf: &mut Vec<u8>,
    ) -> Result<()>;
    fn write_json_value(
        &self,
        from: Option<usize>,
        buf: &mut Vec<u8>,
    ) -> Result<()>;
    fn last_json_value(&self) -> Option<Value>;
    fn write_csv_column(
        &self,
        from: Option<usize>,
        to: Option<usize>,
        buf: &mut String,
    ) -> Result<()>;
}
Expand description

Type-erased trait for serializable vectors.

Required Methods§

Source

fn write_json( &self, from: Option<usize>, to: Option<usize>, buf: &mut Vec<u8>, ) -> Result<()>

Write JSON array to output buffer

Source

fn write_json_value(&self, from: Option<usize>, buf: &mut Vec<u8>) -> Result<()>

Write single JSON value to output buffer (first value in range)

Source

fn last_json_value(&self) -> Option<Value>

Return the last value as a serde_json::Value, or None if empty

Source

fn write_csv_column( &self, from: Option<usize>, to: Option<usize>, buf: &mut String, ) -> Result<()>

Write all values as CSV cells (newline-separated) directly without materializing a Vec.

Implementors§

Source§

impl<V> AnySerializableVec for V
where V: TypedVec + ReadableVec<V::I, V::T>, V::T: Serialize + Formattable,

Available on crate feature serde only.