Function http_status_codes2::find_by_code
source · pub fn find_by_code(
code: usize,
registry: &[(usize, &'static str, &'static str, &'static str)]
) -> Option<(usize, &'static str, &'static str, &'static str)>
Expand description
Search for a HTTP status by its code in a given registry.
Exaple:
use http_status_codes2::{find_by_code, status_code_registry::CODE_REGISTRY};
assert_eq!(
find_by_code(100, &CODE_REGISTRY),
Some((
100,
"Continue",
"[RFC9110, Section 15.2.1]",
"https://www.rfc-editor.org/rfc/rfc9110.html#section-15.2.1"
))
);
assert_eq!(find_by_code(600, &CODE_REGISTRY), None);