leptos_struct_table/
uuid.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! Support for [uuid::Uuid] type.
use crate::*;
use ::uuid::Uuid;
use leptos::prelude::*;

/// Implementation for [`Uuid`] to work with the [`TableRow`] derive and the [`DefaultTableCellRenderer`]
/// ```
/// # use leptos_struct_table::*;
/// # use leptos::prelude::*;
/// # use uuid::Uuid;
/// #[derive(TableRow, Clone)]
/// #[table]
/// struct SomeStruct {
///     my_field: Uuid
/// }
/// ```
impl CellValue<Uuid> for Uuid {
    type RenderOptions = ();

    fn render_value(self, _options: Self::RenderOptions) -> impl IntoView {
        self.to_string()
    }
}