pub trait CellValue {
type RenderOptions: Default;
// Required method
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView;
}
Expand description
A value that can be rendered as part of a table, required for types if the crate::DefaultTableCellRenderer()
is used
Required Associated Types§
Sourcetype RenderOptions: Default
type RenderOptions: Default
Formatting options for this cell value type, needs to implement default and have public named fields, the empty tuple: () is fine if no formatting options can be accepted.
Required Methods§
Sourcefn render_value(self, options: &Self::RenderOptions) -> impl IntoView
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
This is called to actually render the value. The parameter options
is filled by the #[table(format(...))]
macro attribute or Default::default()
if omitted.
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.
Implementations on Foreign Types§
Source§impl CellValue for &'static str
impl CellValue for &'static str
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for &String
impl CellValue for &String
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for Cow<'static, str>
impl CellValue for Cow<'static, str>
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for IpAddr
impl CellValue for IpAddr
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for SocketAddr
impl CellValue for SocketAddr
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for View
impl CellValue for View
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for bool
impl CellValue for bool
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for char
impl CellValue for char
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for f32
impl CellValue for f32
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for f64
impl CellValue for f64
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for i8
impl CellValue for i8
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for i16
impl CellValue for i16
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for i32
impl CellValue for i32
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for i64
impl CellValue for i64
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for i128
impl CellValue for i128
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for isize
impl CellValue for isize
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for u8
impl CellValue for u8
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for u16
impl CellValue for u16
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for u32
impl CellValue for u32
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for u64
impl CellValue for u64
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for u128
impl CellValue for u128
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for usize
impl CellValue for usize
type RenderOptions = NumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for String
impl CellValue for String
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for ToLowercase
impl CellValue for ToLowercase
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for ToUppercase
impl CellValue for ToUppercase
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for Ipv4Addr
impl CellValue for Ipv4Addr
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for Ipv6Addr
impl CellValue for Ipv6Addr
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for SocketAddrV4
impl CellValue for SocketAddrV4
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for SocketAddrV6
impl CellValue for SocketAddrV6
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for Location<'_>
impl CellValue for Location<'_>
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for NaiveDate
impl CellValue for NaiveDate
Implementation for NaiveDate
to work with the TableRow
derive and the DefaultTableCellRenderer
#[derive(TableRow, Clone)]
#[table]
struct SomeStruct {
#[table(format(string = "%Y-%m-%d"))]
my_field: NaiveDate
}
type RenderOptions = RenderChronoOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for NaiveDateTime
impl CellValue for NaiveDateTime
Implementation for NaiveDateTime
to work with the TableRow
derive and the DefaultTableCellRenderer
#[derive(TableRow, Clone)]
#[table]
struct SomeStruct {
#[table(format(string = "%Y-%m-%d %H:%M:%S"))]
my_field: NaiveDateTime
}
type RenderOptions = RenderChronoOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for NaiveTime
impl CellValue for NaiveTime
Implementation for NaiveTime
to work with the TableRow
derive and the DefaultTableCellRenderer
#[derive(TableRow, Clone)]
#[table]
struct SomeStruct {
#[table(format(string = "%H:%M:%S"))]
my_field: NaiveTime
}
type RenderOptions = RenderChronoOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for Fragment
impl CellValue for Fragment
type RenderOptions = ()
fn render_value(self, _options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for Decimal
impl CellValue for Decimal
Implementation for Decimal
to work with the TableRow
derive and the DefaultTableCellRenderer
#[derive(TableRow, Clone)]
#[table]
struct SomeStruct {
#[table(format(precision = 2usize))]
my_field: Decimal
}
type RenderOptions = DecimalNumberRenderOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for Date
impl CellValue for Date
Implementation for Date
to work with the TableRow
derive and the DefaultTableCellRenderer
#[derive(TableRow, Clone)]
#[table]
struct SomeStruct {
#[table(format(string = "[year]-[month]-[day]"))]
my_field: Date
}
type RenderOptions = RenderTimeOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for OffsetDateTime
impl CellValue for OffsetDateTime
Implementation for OffsetDateTime
to work with the TableRow
derive and the DefaultTableCellRenderer
#[derive(TableRow, Clone)]
#[table]
struct SomeStruct {
#[table(format(string = "[year]-[month]-[day] [hour]:[minute]:[second] Z[offset_hour]"))]
my_field: OffsetDateTime
}
type RenderOptions = RenderTimeOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for PrimitiveDateTime
impl CellValue for PrimitiveDateTime
Implementation for PrimitiveDateTime
to work with the TableRow
derive and the DefaultTableCellRenderer
#[derive(TableRow, Clone)]
#[table]
struct SomeStruct {
#[table(format(string = "[year]-[month]-[day] [hour]:[minute]:[second]"))]
my_field: PrimitiveDateTime
}
type RenderOptions = RenderTimeOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for Time
impl CellValue for Time
Implementation for Time
to work with the TableRow
derive and the DefaultTableCellRenderer
#[derive(TableRow, Clone)]
#[table]
struct SomeStruct {
#[table(format(string = "[hour]:[minute]:[second]"))]
my_field: Time
}
type RenderOptions = RenderTimeOptions
fn render_value(self, options: &Self::RenderOptions) -> impl IntoView
Source§impl CellValue for Uuid
impl CellValue for Uuid
Implementation for Uuid
to work with the TableRow
derive and the DefaultTableCellRenderer
#[derive(TableRow, Clone)]
#[table]
struct SomeStruct {
my_field: Uuid
}