GetRowData

Trait GetRowData 

Source
pub trait GetRowData<T> {
    // Required method
    fn get(&self) -> T;
}
Expand description

Provides typed access to row data.

This trait allows columns to extract specific data from rows in a type-safe way. Implement this trait for each piece of data you want to access in your columns.

§Type Parameter

  • T: The type of data to extract from the row

§Example

use dioxus_tabular::GetRowData;

#[derive(Clone, PartialEq)]
struct User {
    id: u32,
    name: String,
    email: String,
}

// Define accessor types
#[derive(Clone, PartialEq)]
struct UserName(String);

#[derive(Clone, PartialEq)]
struct UserEmail(String);

// Implement GetRowData for each accessor
impl GetRowData<UserName> for User {
    fn get(&self) -> UserName {
        UserName(self.name.clone())
    }
}

impl GetRowData<UserEmail> for User {
    fn get(&self) -> UserEmail {
        UserEmail(self.email.clone())
    }
}

Required Methods§

Source

fn get(&self) -> T

Extracts data of type T from this row.

Implementors§