Skip to main content

title_of

Function title_of 

Source
pub fn title_of(text: &str) -> String
Expand description

A title or label of text, as a listing shows it: on one line, each run of whitespace one space, cut to 60 characters (the last an ellipsis when cut).

use rig_memory::title_of;

assert_eq!(title_of("  fix\n the   parser "), "fix the parser");
assert_eq!(title_of(&"a".repeat(80)).chars().count(), 60);