pub fn wrap<T>(value: &T, limit: usize) -> Stringwhere
T: ToString,
Expand description
A function which wraps value to the given width.
ยงExample
use tabled::{Tabled, Table, derive::display};
use tabled::assert::assert_table;
#[derive(Tabled)]
pub struct ZKP<'a> {
application: &'a str,
#[tabled(display("display::wrap", 5))]
state: &'a str,
}
let data = vec![
ZKP { application: "Decentralized Identity", state: "Proved" },
ZKP { application: "Voting Systems", state: "Investigation" },
ZKP { application: "Privacy-Preserving Transactions", state: "" },
];
let table = Table::new(data);
assert_table!(
table,
"+---------------------------------+-------+"
"| application | state |"
"+---------------------------------+-------+"
"| Decentralized Identity | Prove |"
"| | d |"
"+---------------------------------+-------+"
"| Voting Systems | Inves |"
"| | tigat |"
"| | ion |"
"+---------------------------------+-------+"
"| Privacy-Preserving Transactions | |"
"+---------------------------------+-------+"
);