pstr

Macro pstr 

Source
macro_rules! pstr {
    ($string:literal) => { ... };
}
Expand description

Constructs a PopulatedStr from a string literal safely.

§Example

use populated::pstr;
use populated::PopulatedStr;
use std::convert::TryFrom;

assert_eq!("Hello, world!", pstr!("Hello, world!").as_str());
use populated::pstr;
use populated::PopulatedStr;
use std::convert::TryFrom;

assert_eq!("", pstr!("").as_str());

§Safety

This macro is safe to use because it constructs a PopulatedStr from a string literal in a way that is guaranteed to be safe.