Function display_utils::vertical_unicode_block_bars [−][src]
pub fn vertical_unicode_block_bars<I>(
max_height: usize,
proportions: I
) -> VerticalUnicodeBlockBars<I::IntoIter> where
I: IntoIterator<Item = f32>,
I::IntoIter: Clone,
Print a sequence of equalizer-style vertical bars using Unicode block characters.
The bars are very high-resolution: 8 states can be represented per character.
Accepts the total maximum height of the bars and an iterator over each bar’s fill percentage.
let expected_output = "\ █ █ █ ▆█ █ ▄██ █ ▁███ █ ████ █ ▇████ █ ▄█████ █ ▂██████ █ ███████ █ ████████ █ ▅████████ █ ▃█████████ █ ██████████"; assert_eq!( display_utils::vertical_unicode_block_bars(13, [1.0, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].iter().copied() ).to_string(), expected_output, );