Crate lngh_strings

Crate lngh_strings 

Source
Expand description

A small library with some convenient string helpers.

use lngh_strings::{WriteStringExt,WriteLnStringExt,WriteDebugStringExt,WriteLnDebugStringExt};

let pink = (255, 27, 141);
let yellow = (255, 218, 0);
let blue = (27, 179, 255);

let mut string = String::new();
string.writeln("hello world!")
    .writeln("The pan flag's colours are (in rgb):")
    .write("pink: ").writeln_debug(pink)
    .write("yellow: ").writeln_debug(yellow)
    .write("blue: ").write_debug(blue);

let expected =
r#"hello world!
The pan flag's colours are (in rgb):
pink: (255, 27, 141)
yellow: (255, 218, 0)
blue: (27, 179, 255)"#;
assert_eq!(expected, string);

Traits§

WriteDebugStringExt
This an extension trait specifically for appending items with the Debug trait to strings conveniently.
WriteLnDebugStringExt
This an extension trait specifically for appending items with the Debug trait and a newline to strings conveniently.
WriteLnStringExt
This an extension trait specifically for appending to strings conveniently.
WriteStringExt
This an extension trait specifically for appending &str’s to strings conveniently.