Function coap_numbers::code::classify
source · pub fn classify(code: u8) -> Range
Expand description
Find which range a code is in
assert_eq!(classify(GET), Range::Request);
assert_eq!(classify(INTERNAL_SERVER_ERROR), Range::Response(Class::ServerError));
match classify(code) {
Range::Response(Class::Success) => println!("Processing response"),
Range::Response(_) => println!("Some error, probably"),
_ => println!("Protocol violation"),
}