use crate::{MatchType::ToBe, Matcher, TypedMatcher};
pub fn truthy() -> Truthy {
Truthy
}
pub struct Truthy;
impl Matcher<bool> for Truthy {
fn matches(&self, value: &bool) -> bool {
*value
}
fn description(&self) -> String {
"to be truthy".to_string()
}
}
impl TypedMatcher<bool> for Truthy {
fn matcher_type(&self) -> crate::MatchType {
ToBe
}
}
pub fn falsy() -> Falsy {
Falsy
}
pub struct Falsy;
impl Matcher<bool> for Falsy {
fn matches(&self, value: &bool) -> bool {
!value
}
fn description(&self) -> String {
"to be falsy".to_string()
}
}
impl TypedMatcher<bool> for Falsy {
fn matcher_type(&self) -> crate::MatchType {
ToBe
}
}