Function terminal_cli::format_in_columns
[−]
[src]
pub fn format_in_columns<W: FmtWrite>(
strings: &[&str],
width: u16,
spacing: u16,
new_line: &str,
write: &mut W
) -> Result<(), FmtError>
Formats the strings in autocomplete-style column notation. Fills the width of the entire line with a string plus the desired spacing characters. Preserves the ordering in columns.
Examples
let s = vec!["A1", "A2", "A3", "B1", "B2", "C1", "C2"]; let mut out = String::new(); format_in_columns(s.as_slice(), 26, 10, "\r\n", &mut out).unwrap(); println!("{}", out);
A1 B1 C2
A2 B2
A3 C1