Skip to main content

TableRow

Trait TableRow 

Source
pub trait TableRow {
    // Required method
    fn table_schema() -> TableSchema;
}
Expand description

A Rust type that describes a table’s rows.

Implement it by hand, or derive it — the derive reads the struct’s fields and their types, which is the same information a schema carries:

use ytsaurus_client::TableRow;

#[derive(TableRow)]
struct Visit<'a> {
    #[yt(key)]
    host: &'a str,
    size: i64,
    referrer: Option<&'a str>,   // optional, because the Rust type says so
}

client.create_table("//tmp/visits", &Visit::table_schema())?;

Required Methods§

Source

fn table_schema() -> TableSchema

The schema of a table holding these rows.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§