Function any_word_m

Source
pub fn any_word_m<M>(marker: M) -> Token
where M: Hash,
Expand description

A variant of any_word with a marker assigned, making it easy to jump directly to the matched result within the token tree.

ยงExamples

use initiative_core::command::prelude::*;

#[derive(Hash)]
enum Marker {
    AnyWord,
}

let query = "badger mushroom";
let token = sequence([keyword("badger"), any_phrase_m(Marker::AnyWord)]);
let token_match = token.match_input_exact(query, &app_meta).next().await.unwrap();

assert_eq!(
    Some("mushroom"),
    token_match.find_marker(Marker::AnyWord).unwrap().meta_phrase(),
);