[][src]Trait lab_grader::results_file::AsCsv

pub trait AsCsv {
    fn as_csv(&self) -> String;
}

Trait to convert a struct to csv (comma separated values).

Your implementation should not append a newline

Example Implementation

use lab_grader::results_file::AsCsv;

// A dummy struct so we can impl AsCsv
pub struct Point {
    x: i32,
    y: i32
}

impl AsCsv for Point {
    fn as_csv(&self) -> String {
        format!("{},{}", self.x, self.y)
    }
}

let p = Point { x: 4, y: 8 };
assert_eq!(p.as_csv(), "4,8");

Required methods

fn as_csv(&self) -> String

Loading content...

Implementors

impl AsCsv for Submission[src]

Loading content...