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: = Default default;
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 spans = vec!;
let hbox = spans
.iter
.map
.;
assert_eq!;