Skip to main content

check_for_tag

Function check_for_tag 

Source
pub fn check_for_tag<T: Display>(value: &T) -> MaybeTag<String>
Expand description

Checks whether a value’s display representation looks like a YAML tag.

A value is considered a tag if its string representation starts with !.

§Examples

use noyalib::{check_for_tag, MaybeTag};

let result = check_for_tag(&"!mytag");
assert!(matches!(result, MaybeTag::Tag(_)));

let result = check_for_tag(&"plain");
assert!(matches!(result, MaybeTag::NotTag(_)));