pub struct Column<S, T> { /* private fields */ }Expand description
One column of a DataTable or a ServerTable whose rows are T.
A column shows a field of the row with Column::text or
Column::number, or any element with Column::custom. The table
sorts by a column it receives through its sortable_column, which takes
the key the way that table sorts.
use hypersig::Signals;
use hypersig_ui::Column;
use serde::{Deserialize, Serialize};
#[derive(Signals, Serialize, Deserialize)]
struct User {
id: i32,
email: String,
}
#[derive(Signals, Serialize, Deserialize)]
struct Users {
users: Vec<User>,
}
let email: Column<Users, User> = Column::text("Email", User::email());Implementations§
Source§impl<S: 'static, T: 'static> Column<S, T>
impl<S: 'static, T: 'static> Column<S, T>
Sourcepub fn text(header: impl Into<String>, field: Sig<T, String>) -> Self
pub fn text(header: impl Into<String>, field: Sig<T, String>) -> Self
A column headed header that shows the text field field of each row.
Sourcepub fn number<U: Number + Textual + 'static>(
header: impl Into<String>,
field: Sig<T, U>,
) -> Self
pub fn number<U: Number + Textual + 'static>( header: impl Into<String>, field: Sig<T, U>, ) -> Self
A column headed header that shows the number field field, aligned to the end.
Sourcepub fn formatted<U: Number + 'static>(
header: impl Into<String>,
field: Sig<T, U>,
format: NumberFormat,
) -> Self
pub fn formatted<U: Number + 'static>( header: impl Into<String>, field: Sig<T, U>, format: NumberFormat, ) -> Self
A column headed header that shows the number field field written in format.
use hypersig::{NumberFormat, Signals};
use hypersig_ui::Column;
use serde::{Deserialize, Serialize};
#[derive(Signals, Serialize, Deserialize)]
struct Payment {
amount: f64,
}
#[derive(Signals, Serialize, Deserialize)]
struct Ledger {
payments: Vec<Payment>,
}
const DOLLARS: NumberFormat = NumberFormat::new().digits(2).prefix("$");
let amount: Column<Ledger, Payment> = Column::formatted("Amount", Payment::amount(), DOLLARS);Trait Implementations§
Auto Trait Implementations§
impl<S, T> !RefUnwindSafe for Column<S, T>
impl<S, T> !Send for Column<S, T>
impl<S, T> !Sync for Column<S, T>
impl<S, T> !UnwindSafe for Column<S, T>
impl<S, T> Freeze for Column<S, T>
impl<S, T> Unpin for Column<S, T>
impl<S, T> UnsafeUnpin for Column<S, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more