Skip to main content

Tabular

Trait Tabular 

Source
pub trait Tabular {
    // Required method
    fn tabular_spec() -> TabularSpec;
}
Expand description

Trait for types that can generate a TabularSpec.

This trait is automatically implemented by #[derive(Tabular)].

§Example

use standout::tabular::{Tabular, TabularSpec};
use serde::Serialize;

#[derive(Serialize, Tabular)]
struct Task {
    #[col(width = 8, style = "muted")]
    id: String,

    #[col(width = "fill")]
    title: String,

    #[col(width = 12, align = "right")]
    status: String,
}

// Use the generated spec
let spec = Task::tabular_spec();

Required Methods§

Source

fn tabular_spec() -> TabularSpec

Returns the TabularSpec for this type.

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§