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§
Sourcefn create_empty_decoded_row(&mut self) -> R
fn create_empty_decoded_row(&mut self) -> R
Creates a new empty row for decoding
Sourcefn encode_column(&mut self, src_row: &R, column: usize, dst: &mut String)
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.
Sourcefn decode_column(
&mut self,
src_data: &str,
column: usize,
dst_row: &mut R,
) -> Result<(), DecodeErrorBehavior>
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 ()
impl<R> RowCodec<R> for ()
A placeholder codec for row viewers that not require serialization.