#buffered #buffering #write #display #io #elements #writer

display_buffered

A small library that provides convinience functions to write all the elements into a writer with buffering

6 releases

0.1.7 Mar 30, 2023
0.1.6 Mar 27, 2023

#964 in Algorithms

Download history 15/week @ 2024-02-20 3/week @ 2024-02-27 14/week @ 2024-03-12 9/week @ 2024-03-26 40/week @ 2024-04-02

74 downloads per month

MIT license

10KB
164 lines

display_buffered

A small library that provides convinience function to write all the elements into a writer with buffering

Examples

use display_buffered::display_buffered;

use std::io::stdout;

// Prints 10, 20 and 30 on sepparate lines
display_buffered([10, 20, 30], stdout()).unwrap()
use display_buffered::write_buffered;

use std::io::stdout;

// Prints 102030
write_buffered(["10", "20", "30"], stdout()).unwrap()
use display_buffered::write_buffered_separated;

use std::io::stdout;

// Prints "It_Just_Works"
write_buffered_separated(["It", "Just", "Works"], stdout(), b"_").unwrap()
use display_buffered::write_buffered_separated_with;

use std::io::stdout;

write_buffered_separated_with(["It", "Just", "Works"], stdout(), |i, _| {
if i % 2 == 0 {
    "_"
} else {
    "-"
}
})
.unwrap(); // Prints "It-Just_Works"

lib.rs:

Provides convinience functions to write all the elements into a writer with buffering

No runtime deps