Function any_phrase_m

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

A variant of any_phrase 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 {
    AnyPhrase,
}

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

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