No longer required in current implementation
BFGL6BCMV2MMWEF6ZRTUCKBE2EHKUQRCTPZLFAECZGDANVIEXLUQC
CQEA2ZDITRMPXKCO5T346QH7JJOOGOPRC66F3MG6VEMEQGLYYUZAC
HEIF2O2ELHA3M7K77CK7AHBZ4656AUS3QW5M4E2DUY7ECOLVWKIAC
2N3KOCP74PCK2ETO5PCWBDR5PA57DDNT2KR4JLBPZPQPA56SAR4QC
RAWT2FQSTIP6EWFQXMAESASEM6AIFCV4PDO6TRUN6EAFVP3526YQC
BA5Y6VSEHJQBOYBS6R6FE6IZDRNAPNIN5ITJXWK7L46RJVHNI7JAC
GYTRFADRDO4SYXV6V3PEPGGFIRDHQH5YBTKEJCWFAIZ5CX4P46NAC
JCYJWUI32EEUQVQBLUNTSWZI6OXZJIRQMDU72DXWTJVU2LJJ6QWQC
// Safely wrap i64 header levels in an enum
enum HeaderLevel {
H1,
H2,
H3,
H4,
H5,
H6,
}
// This is not TryFrom as there's not really much we can do to handle the error?
impl From<NonZeroUsize> for HeaderLevel {
fn from(value: NonZeroUsize) -> Self {
match value.get() {
1 => HeaderLevel::H1,
2 => HeaderLevel::H2,
3 => HeaderLevel::H3,
4 => HeaderLevel::H4,
5 => HeaderLevel::H5,
6 => HeaderLevel::H6,
_ => panic!(
"Unexpected header level! Headers must be in range of 1 to 6 (inclusive), got: {}",
value
),
}
}
}
impl From<HeaderLevel> for &str {
fn from(value: HeaderLevel) -> Self {
match value {
HeaderLevel::H1 => "h1",
HeaderLevel::H2 => "h2",
HeaderLevel::H3 => "h3",
HeaderLevel::H4 => "h4",
HeaderLevel::H5 => "h5",
HeaderLevel::H6 => "h6",
}
}
}