Trait zng::text::ToTxt

source ·
pub trait ToTxt {
    // Required method
    fn to_txt(&self) -> Txt;
}
Expand description

A trait for converting a value to a Txt.

This trait is automatically implemented for any type which implements the ToString trait.

You can use formatx! to format! a text.

Required Methods§

source

fn to_txt(&self) -> Txt

Converts the given value to an owned Txt.

§Examples

Basic usage:

use zng_txt::*;

let expected = formatx!("10");
let actual = 10.to_txt();

assert_eq!(expected, actual);

Implementors§

source§

impl<T> ToTxt for T
where T: ToString,