Function yn::yes [−][src]
pub fn yes(
string: impl Display
) -> bool
Determines if a value is a form of yes.
Returns true when the value is and/or contains (see examples for clarification) "y"
, "yes"
, true
or 1
.
Examples
yes should be yes:
assert!(yn::yes("y")); assert!(yn::yes("yes")); assert!(yn::yes("true true true really true")); assert!(yn::yes("double up to make sure, yes yes y y true true 1 1")); assert!(yn::yes("definitely yes"));
should definitely not be yes:
assert!(!yn::yes("no")); assert!(!yn::yes("this is definitely a no.")); assert!(!yn::yes("false"));