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

Function case

src/tests/from_bits.rs:26–45  ·  view source on GitHub ↗
(
    expected: Option<T::Bits>,
    input: T::Bits,
    inherent: impl FnOnce(T::Bits) -> Option<T>,
)

Source from the content-addressed store, hash-verified

24
25#[track_caller]
26fn case<T: Flags>(
27 expected: Option<T::Bits>,
28 input: T::Bits,
29 inherent: impl FnOnce(T::Bits) -> Option<T>,
30) where
31 <T as Flags>::Bits: std::fmt::Debug + PartialEq,
32{
33 assert_eq!(
34 expected,
35 inherent(input).map(|f| f.bits()),
36 "T::from_bits({:?})",
37 input
38 );
39 assert_eq!(
40 expected,
41 T::from_bits(input).map(|f| f.bits()),
42 "Flags::from_bits({:?})",
43 input
44 );
45}

Callers 1

casesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected