logo
macro_rules! ident {
    ($($arg:tt)*) => { ... };
}
Expand description

Convenience macro for constructing an Ident from a format string.

The arguments to this macro are forwarded to std::format_args.

Panics

The macro will cause a panic if the formatted string is not a valid identifier.

Examples

use valence::ident;

let namespace = "my_namespace";
let apple = ident!("{namespace}:apple");

assert_eq!(apple.namespace(), Some("my_namespace"));
assert_eq!(apple.path(), "apple");