egui_data_table::viewer

Trait RowCodec

Source
pub trait RowCodec<R> {
    type DeserializeError;

    // Required methods
    fn create_empty_decoded_row(&mut self) -> R;
    fn encode_column(&mut self, src_row: &R, column: usize, dst: &mut String);
    fn decode_column(
        &mut self,
        src_data: &str,
        column: usize,
        dst_row: &mut R,
    ) -> Result<(), DecodeErrorBehavior>;
}
Expand description

A trait for encoding/decoding row data. Any valid UTF-8 string can be used for encoding, however, as csv is used for clipboard operations, it is recommended to serialize data in simple string format as possible.

Required Associated Types§

Required Methods§

Source

fn create_empty_decoded_row(&mut self) -> R

Creates a new empty row for decoding

Source

fn encode_column(&mut self, src_row: &R, column: usize, dst: &mut String)

Tries encode column data of given row into a string. As the cell for CSV row is already occupied, if any error or unsupported data is found for that column, just empty out the destination string buffer.

Source

fn decode_column( &mut self, src_data: &str, column: usize, dst_row: &mut R, ) -> Result<(), DecodeErrorBehavior>

Tries decode column data from a string into a row.

Implementations on Foreign Types§

Source§

impl<R> RowCodec<R> for ()

A placeholder codec for row viewers that not require serialization.

Source§

type DeserializeError = ()

Source§

fn create_empty_decoded_row(&mut self) -> R

Source§

fn encode_column(&mut self, src_row: &R, column: usize, dst: &mut String)

Source§

fn decode_column( &mut self, src_data: &str, column: usize, dst_row: &mut R, ) -> Result<(), DecodeErrorBehavior>

Implementors§