Macro abi_stable::rstr

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

Constructs RStr constants from &'static str constants.

§Examples

use abi_stable::{
    std_types::RStr,
    rstr,
};


const FOO: RStr<'_> = rstr!("");
// `RStr<'_>`s can be compared with `&str`s
assert_eq!(FOO, "");

const BAR_STR: &str = "1235813";
// constructing `RStr<'_>` from a `&str` non-literal constant
const BAR: RStr<'_> = rstr!(BAR_STR);
assert_eq!(BAR, "1235813");