[][src]Trait tablefy::Tablefy

pub trait Tablefy {
    fn get_headers() -> Row;
fn into_row(&self) -> Row; }

The main trait of the library. Has two main functions with which a table can be constructed.

Required methods

fn get_headers() -> Row

Retrieves the headers of the table.

If derived, the headers will be the field names of the struct. Currently custom names aren't supported, but they may be implemented in the future.

fn into_row(&self) -> Row

Turns the contents of a struct into a row.

If derived, all the contents are saved as a String. This is to facilitate displaying as a full table. However, in order for the derivation to work, all the fields of the struct must implement the Display trait. Otherwise the code won't compile.

struct Thing {
    name : String,
    age : i8,
    location : String
}
Loading content...

Implementors

Loading content...