mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-24 01:00:49 +00:00
Reuse table_formatting
logic for almost everything (#39)
This commit is contained in:
parent
54426ed477
commit
13683aa229
5 changed files with 273 additions and 388 deletions
|
@ -17,9 +17,9 @@ impl Align {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn table_formatting<const N: usize, S: AsRef<str> + std::fmt::Debug, Ts: AsRef<[[S; N]]>>(
|
||||
headers: &[&'static str; N],
|
||||
padding: &[Align; N],
|
||||
pub fn table_formatting_unsafe<S: AsRef<str> + std::fmt::Debug, Ss: AsRef<[S]>, Ts: AsRef<[Ss]>>(
|
||||
headers: &[&str],
|
||||
padding: &[Align],
|
||||
table: Ts,
|
||||
) -> String {
|
||||
let table = table.as_ref();
|
||||
|
@ -68,3 +68,11 @@ pub fn table_formatting<const N: usize, S: AsRef<str> + std::fmt::Debug, Ts: AsR
|
|||
m.push("```");
|
||||
m.build()
|
||||
}
|
||||
|
||||
pub fn table_formatting<const N: usize, S: AsRef<str> + std::fmt::Debug, Ts: AsRef<[[S; N]]>>(
|
||||
headers: &[&'static str; N],
|
||||
padding: &[Align; N],
|
||||
table: Ts,
|
||||
) -> String {
|
||||
table_formatting_unsafe(headers, padding, table)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue