pub fn text_str(s: &str) -> Box<Layout>Expand description
Creates a text layout from a string slice.
This is a convenience function that converts a &str to a String and creates
a text layout. It’s equivalent to text(s.to_string()) but more ergonomic.
§Parameters
s- The string slice to convert into a text layout
§Returns
A boxed Layout::Text containing the string.
§Examples
use typeset::*;
// More convenient than text() for string literals
let greeting = text_str("Hello");
assert_eq!(format_layout(greeting, 2, 80), "Hello");
// Equivalent to using text() with to_string()
let a = text_str("content");
let b = text("content".to_string());
assert_eq!(
format_layout(a, 2, 80),
format_layout(b, 2, 80)
);§See Also
text- The underlying function that takesString- Common text constructors: [
space], [comma], [semicolon]