pub const DEPTH_HEADER: &str = "Depth";
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Depth {
Zero,
One,
Infinity,
}
impl Depth {
pub const fn as_header_value(self) -> &'static str {
match self {
Self::Zero => "0",
Self::One => "1",
Self::Infinity => "infinity",
}
}
}
#[cfg(test)]
mod tests {
use super::{DEPTH_HEADER, Depth};
#[test]
fn header_values_use_the_specification_tokens() {
assert_eq!(Depth::Zero.as_header_value(), "0");
assert_eq!(Depth::One.as_header_value(), "1");
assert_eq!(Depth::Infinity.as_header_value(), "infinity");
}
#[test]
fn header_name_keeps_its_canonical_spelling() {
assert_eq!(DEPTH_HEADER, "Depth");
}
}