text

Function text 

Source
pub fn text<C: Cost>(s: impl ToString) -> Doc<C>
Expand description

Creates a document that renders a single-line string.

It is very important that the string not contain any newline characters ('\n'), as the printer expects that newlines only come from newline documents. A text with newlines in it will cause the printer to have an incorrect perception of the layouts it is choosing between.

§Example

let doc = text("Bulbasaur");
assert_eq!(doc.to_string(), "Bulbasaur");

§Convenience aliases

This crate defines some functions for common bits of text: