Macro const_str::from_utf8

source ·
macro_rules! from_utf8 {
    ($s: expr) => { ... };
}
Expand description

Converts a byte string to a string slice

§Examples

const BYTE_PATH: &[u8] = b"/tmp/file";
const PATH: &str = const_str::from_utf8!(BYTE_PATH);

assert_eq!(PATH, "/tmp/file");