macro_rules! as_str {
($reff:expr) => { ... };
}Expand description
Macro version of StrLike::as_str, which can be used in const.
ยงExample
use tstr::{strlike::as_str, ts};
// accepts `str` with any amount of layers of references
assert_eq!(const { as_str!("foo") }, "foo");
assert_eq!(const { as_str!(&"bar") }, "bar");
assert_eq!(const { as_str!(&&"baz") }, "baz");
assert_eq!(const { as_str!(&&&"qux") }, "qux");
// accepts `TStr` with any amount of layers of references
assert_eq!(const { as_str!(ts!(foo)) }, "foo");
assert_eq!(const { as_str!(&ts!(bar)) }, "bar");
assert_eq!(const { as_str!(&&ts!(baz)) }, "baz");