MCPcopy Create free account
hub / github.com/bitflags/bitflags / case

Function case

src/tests/contains.rs:87–108  ·  view source on GitHub ↗
(
    value: T,
    inputs: &[(T, bool)],
    mut inherent: impl FnMut(&T, T) -> bool,
)

Source from the content-addressed store, hash-verified

85
86#[track_caller]
87fn case<T: Flags + std::fmt::Debug + Copy>(
88 value: T,
89 inputs: &[(T, bool)],
90 mut inherent: impl FnMut(&T, T) -> bool,
91) {
92 for (input, expected) in inputs {
93 assert_eq!(
94 *expected,
95 inherent(&value, *input),
96 "{:?}.contains({:?})",
97 value,
98 input
99 );
100 assert_eq!(
101 *expected,
102 Flags::contains(&value, *input),
103 "Flags::contains({:?}, {:?})",
104 value,
105 input
106 );
107 }
108}

Callers 1

casesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected