optimalstrategy / plain-msgbox

A crate for generating plain message boxes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plain-msgbox

A crate for generating plain message boxes like the one below (formatting is manual):

╭────────────────────────────────╮
│ Call stack size:     1024      │
│ Interning threshold: 20        │
│ Optimization level:  1         │
│ Optimizations:                 │
│   Constant Folding:       true │
│   Peephole Optimizations: true │
│   Tail Call Optimization: true │
│   Dead Code Elimination:  true │
│ (misc): cfg_export = false     │
│ (misc): caching    = true<Config>─────────────────────────╯

Usage

Add this to your Cargo.toml:

[dependencies]
plain_msgbox = { git = "https://github.com/optimalstrategy/plain-msgbox" }

Then generate some boxes:

use plain_msgbox::generate_box;

let msg = generate_box(&[
    format!("A vec:    {:?}", vec![1, 2, 3]),
    format!("A tuple:  {:?}", (1, 2, 3)),
    format!("A string: {}", "abcdefghi"),
]);
assert_eq!(msg, "\
╭─────────────────────╮
│ A vec:    [1, 2, 3] │
│ A tuple:  (1, 2, 3) │
│ A string: abcdefghi │
╰─────────────────────╯");

About

A crate for generating plain message boxes

License:MIT License


Languages

Language:Rust 100.0%