CsvIO

Trait CsvIO 

Source
pub trait CsvIO: Sized {
    // Required methods
    fn from_csv(csv: &str) -> Self;
    fn to_csv(&self) -> String;

    // Provided methods
    fn read_csv(path: &str) -> Self { ... }
    fn write_csv(&self, path: &str) { ... }
}
Expand description

A trait for reading and writing CSV files.

Required Methods§

Source

fn from_csv(csv: &str) -> Self

Create an instance of the type from a CSV string.

§Arguments
  • csv - The CSV string to parse.
§Returns

A new instance of the type.

Source

fn to_csv(&self) -> String

Convert the instance to a CSV string.

§Returns

A CSV string representation of the instance.

Provided Methods§

Source

fn read_csv(path: &str) -> Self

Create an instance of the type from a CSV file.

§Arguments
  • path - The path to the CSV file to read.
§Returns

A new instance of the type.

Source

fn write_csv(&self, path: &str)

Write the instance to a CSV file.

§Arguments
  • path - The path to the CSV file to write.

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.

Implementors§