borderline 1.0.0

A simple crate to use borders in your terminal.
Documentation
  • Coverage
  • 90%
    9 out of 10 items documented0 out of 9 items with examples
  • Size
  • Source code size: 15.84 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 318.5 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • SommerEngineering

Borderline

Borderline is a Crate to render borders to the terminal. You can place text or progress bars inside the borders. The usage is as simple as:

use borderline::LineBuilder;

// Create a line builder:
let mut lb = LineBuilder::new();

// Print the header first:
borderline::print_header("Borderline Test-Drive");

// Now, we are able to attach as many "line" as we want.
// Every line must be started with a call to `line_begin`
// and ended with a call to `line_end`:
lb.line_begin("- Loading...");

// perform other actions here...

// When ending a line, you can specify the second part
// of the line, which will be printed on the right side:
lb.line_end("done.");

// You can also print a progress bar:
lb.line_begin("- Loading many files:");

// Set up the progress bar using the total number of steps:
lb.progress_bar_setup(1_000);

// Do some work and update the progress bar:
for i in 0..1_000 {
    sleep(std::time::Duration::from_millis(50));
    lb.progress_bar_update(i);
}

// End the progress bar:
lb.progressbar_end();

// End the line and print the second text part:
lb.line_end("done.");

// At the end, we can print the closing border:
borderline::print_border();

While the progress bar is active: progressbar.png

When the program is done: done.png

In case that the given text is too long, it gets wrapped at word boundaries. When this is not possible, the text is wrapped at the given width.

Changelog

Version 1.0.0

  • Initial release