stylish_stringlike
This crate provides a string-like API for styled text objects, and widgets for displaying those styled text objects specifically oriented towards terminal output.
usage
Add this to you Cargo.toml:
[]
= "0.2.0"
Example
use Cow;
use ;
use ;
let italic = new;
let bold = new;
let underline = new;
let foo: = new;
let bar: = new;
// Spans of different styles can be joined together.
let foobar = foo.join;
assert_eq!;
// Perform literal string replacement with the `replace` method.
let foobaz = foobar.replace;
assert_eq!;
let mut buz: = Defaultdefault;
buz.push;
// Replace text with styled text objects instead of string literals.
let foobuz = foobar.replace;
assert_eq!;
// Use the `slice` method to slice on bytes.
let foob = foobar.slice.unwrap;
assert_eq!;
// Use the `HBox` widget to truncate multiple spans of text to fit in a desired width.
let truncation = Inner;
let first_spans = make_spans;
let second_spans = make_spans;
let first_segment = new;
let second_segment = new;
let mut hbox: = Defaultdefault;
hbox.push;
hbox.push;
assert_eq!;