Skip to main content

CellsSchema

Trait CellsSchema 

Source
pub trait CellsSchema {
    type Source: ?Sized;

    // Required method
    fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>);
}
Expand description

Column definitions.

Define columns using CellsFormatter.

To dynamically create a CellsSchema, use cells_schema.

§Examples

use text_grid::*;

struct MyCellsSchema {
    len: usize,
}

impl CellsSchema for MyCellsSchema {
    type Source = [u32; 3];
    fn fmt(&self, f: &mut CellsFormatter<[u32; 3]>) {
        for i in 0..self.len {
            f.column(i, |s| s[i]);
        }
    }
}

let rows = [
   [1, 2, 3],
   [4, 5, 6],
];
let schema = MyCellsSchema { len: 3 };
let g = to_grid_with_schema(rows, schema);

assert_eq!(format!("\n{g}"), r#"
 0 | 1 | 2 |
---|---|---|
 1 | 2 | 3 |
 4 | 5 | 6 |
"#);

Required Associated Types§

Required Methods§

Source

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Define column information. see CellsFormatter for details.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> CellsSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized, T3: CellsSchema, T3::Source: Sized, T4: CellsSchema, T4::Source: Sized, T5: CellsSchema, T5::Source: Sized, T6: CellsSchema, T6::Source: Sized, T7: CellsSchema, T7::Source: Sized, T8: CellsSchema, T8::Source: Sized, T9: CellsSchema, T9::Source: Sized, T10: CellsSchema, T10::Source: Sized, T11: CellsSchema, T11::Source: Sized, T12: CellsSchema, T12::Source: Sized, T13: CellsSchema, T13::Source: Sized, T14: CellsSchema, T14::Source: Sized, T15: CellsSchema, T15::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source, <T7 as CellsSchema>::Source, <T8 as CellsSchema>::Source, <T9 as CellsSchema>::Source, <T10 as CellsSchema>::Source, <T11 as CellsSchema>::Source, <T12 as CellsSchema>::Source, <T13 as CellsSchema>::Source, <T14 as CellsSchema>::Source, <T15 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> CellsSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized, T3: CellsSchema, T3::Source: Sized, T4: CellsSchema, T4::Source: Sized, T5: CellsSchema, T5::Source: Sized, T6: CellsSchema, T6::Source: Sized, T7: CellsSchema, T7::Source: Sized, T8: CellsSchema, T8::Source: Sized, T9: CellsSchema, T9::Source: Sized, T10: CellsSchema, T10::Source: Sized, T11: CellsSchema, T11::Source: Sized, T12: CellsSchema, T12::Source: Sized, T13: CellsSchema, T13::Source: Sized, T14: CellsSchema, T14::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source, <T7 as CellsSchema>::Source, <T8 as CellsSchema>::Source, <T9 as CellsSchema>::Source, <T10 as CellsSchema>::Source, <T11 as CellsSchema>::Source, <T12 as CellsSchema>::Source, <T13 as CellsSchema>::Source, <T14 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> CellsSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized, T3: CellsSchema, T3::Source: Sized, T4: CellsSchema, T4::Source: Sized, T5: CellsSchema, T5::Source: Sized, T6: CellsSchema, T6::Source: Sized, T7: CellsSchema, T7::Source: Sized, T8: CellsSchema, T8::Source: Sized, T9: CellsSchema, T9::Source: Sized, T10: CellsSchema, T10::Source: Sized, T11: CellsSchema, T11::Source: Sized, T12: CellsSchema, T12::Source: Sized, T13: CellsSchema, T13::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source, <T7 as CellsSchema>::Source, <T8 as CellsSchema>::Source, <T9 as CellsSchema>::Source, <T10 as CellsSchema>::Source, <T11 as CellsSchema>::Source, <T12 as CellsSchema>::Source, <T13 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> CellsSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized, T3: CellsSchema, T3::Source: Sized, T4: CellsSchema, T4::Source: Sized, T5: CellsSchema, T5::Source: Sized, T6: CellsSchema, T6::Source: Sized, T7: CellsSchema, T7::Source: Sized, T8: CellsSchema, T8::Source: Sized, T9: CellsSchema, T9::Source: Sized, T10: CellsSchema, T10::Source: Sized, T11: CellsSchema, T11::Source: Sized, T12: CellsSchema, T12::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source, <T7 as CellsSchema>::Source, <T8 as CellsSchema>::Source, <T9 as CellsSchema>::Source, <T10 as CellsSchema>::Source, <T11 as CellsSchema>::Source, <T12 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> CellsSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized, T3: CellsSchema, T3::Source: Sized, T4: CellsSchema, T4::Source: Sized, T5: CellsSchema, T5::Source: Sized, T6: CellsSchema, T6::Source: Sized, T7: CellsSchema, T7::Source: Sized, T8: CellsSchema, T8::Source: Sized, T9: CellsSchema, T9::Source: Sized, T10: CellsSchema, T10::Source: Sized, T11: CellsSchema, T11::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source, <T7 as CellsSchema>::Source, <T8 as CellsSchema>::Source, <T9 as CellsSchema>::Source, <T10 as CellsSchema>::Source, <T11 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> CellsSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source, <T7 as CellsSchema>::Source, <T8 as CellsSchema>::Source, <T9 as CellsSchema>::Source, <T10 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> CellsSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source, <T7 as CellsSchema>::Source, <T8 as CellsSchema>::Source, <T9 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> CellsSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source, <T7 as CellsSchema>::Source, <T8 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> CellsSchema for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source, <T7 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5, T6> CellsSchema for (T0, T1, T2, T3, T4, T5, T6)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized, T3: CellsSchema, T3::Source: Sized, T4: CellsSchema, T4::Source: Sized, T5: CellsSchema, T5::Source: Sized, T6: CellsSchema, T6::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source, <T6 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4, T5> CellsSchema for (T0, T1, T2, T3, T4, T5)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized, T3: CellsSchema, T3::Source: Sized, T4: CellsSchema, T4::Source: Sized, T5: CellsSchema, T5::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source, <T5 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3, T4> CellsSchema for (T0, T1, T2, T3, T4)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized, T3: CellsSchema, T3::Source: Sized, T4: CellsSchema, T4::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source, <T4 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2, T3> CellsSchema for (T0, T1, T2, T3)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized, T3: CellsSchema, T3::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source, <T3 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1, T2> CellsSchema for (T0, T1, T2)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized, T2: CellsSchema, T2::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source, <T2 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0, T1> CellsSchema for (T0, T1)
where T0: CellsSchema, T0::Source: Sized, T1: CellsSchema, T1::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source, <T1 as CellsSchema>::Source)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T0> CellsSchema for (T0,)
where T0: CellsSchema, T0::Source: Sized,

Source§

type Source = (<T0 as CellsSchema>::Source,)

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T: ?Sized + CellsSchema> CellsSchema for &T

Source§

type Source = <T as CellsSchema>::Source

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T: CellsSchema> CellsSchema for Vec<T>

Source§

type Source = <T as CellsSchema>::Source

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Source§

impl<T: CellsSchema> CellsSchema for [T]

Source§

type Source = <T as CellsSchema>::Source

Source§

fn fmt(&self, f: &mut CellsFormatter<'_, '_, Self::Source>)

Implementors§