pub trait TableDataContent: Default + PartialEq + Serialize {
    // Required methods
    fn ensures_consistency(
        &mut self,
        context: &[TableElem]
    ) -> Result<(), String>;
    fn read_datatable_content<R: BufRead>(
        &mut self,
        reader: &mut Reader<R>,
        reader_buff: &mut Vec<u8>,
        context: &[TableElem]
    ) -> Result<(), VOTableError>;
    fn read_binary_content<R: BufRead>(
        &mut self,
        reader: &mut Reader<R>,
        reader_buff: &mut Vec<u8>,
        context: &[TableElem]
    ) -> Result<(), VOTableError>;
    fn read_binary2_content<R: BufRead>(
        &mut self,
        reader: &mut Reader<R>,
        reader_buff: &mut Vec<u8>,
        context: &[TableElem]
    ) -> Result<(), VOTableError>;
    fn write_in_datatable<W: Write>(
        &mut self,
        writer: &mut Writer<W>,
        context: &[TableElem]
    ) -> Result<(), VOTableError>;
    fn write_in_binary<W: Write>(
        &mut self,
        writer: &mut Writer<W>,
        context: &[TableElem]
    ) -> Result<(), VOTableError>;
    fn write_in_binary2<W: Write>(
        &mut self,
        writer: &mut Writer<W>,
        context: &[TableElem]
    ) -> Result<(), VOTableError>;

    // Provided method
    fn new() -> Self { ... }
}

Required Methods§

source

fn ensures_consistency(&mut self, context: &[TableElem]) -> Result<(), String>

When deserializing from JSON, TOML or YAML, we should implement a ‘DeserializeSeed’ based on the table Schema. But:

  • we have to implement Deserialize by hand on Table, Data, DataElem, TableData, Binary, Binary2 and Stream, which is daunting task, even using cargo expand
  • even so, the metadata may be parsed after the data (e.g. in JSON the key order is not guaranteed to be preserved)

So, the result of the deserialization without knowing the table schema may result in no-homogeneous datatype in a same column. E.g short and int, or char and string may be mixed.

So, we use this method to replace incorrect types by the porper ones as a post-parsing process. This is not ideal on a performance point-of-view, but Serde usage to convert from JSON, TOML and YAML should be limited to small tables (less than a few hundreds of megabytes).

source

fn read_datatable_content<R: BufRead>( &mut self, reader: &mut Reader<R>, reader_buff: &mut Vec<u8>, context: &[TableElem] ) -> Result<(), VOTableError>

Called when Event::Start(“DATATABLE”) as been detected and MUST return after event Event::End(“DATATABLE”)

source

fn read_binary_content<R: BufRead>( &mut self, reader: &mut Reader<R>, reader_buff: &mut Vec<u8>, context: &[TableElem] ) -> Result<(), VOTableError>

Called when Event::Start(“STREAM”) as been detected (in BINARY) and MUST return after event Event::End(“STREAM”)

source

fn read_binary2_content<R: BufRead>( &mut self, reader: &mut Reader<R>, reader_buff: &mut Vec<u8>, context: &[TableElem] ) -> Result<(), VOTableError>

Called when Event::Start(“STREAM”) as been detected (in BINARY2) and MUST return after event Event::End(“STREAM”)

source

fn write_in_datatable<W: Write>( &mut self, writer: &mut Writer<W>, context: &[TableElem] ) -> Result<(), VOTableError>

source

fn write_in_binary<W: Write>( &mut self, writer: &mut Writer<W>, context: &[TableElem] ) -> Result<(), VOTableError>

source

fn write_in_binary2<W: Write>( &mut self, writer: &mut Writer<W>, context: &[TableElem] ) -> Result<(), VOTableError>

Provided Methods§

source

fn new() -> Self

Object Safety§

This trait is not object safe.

Implementors§