#[non_exhaustive]pub enum Case {
Lower,
Upper,
}Available on crate feature
encoding-bech32 only.Expand description
Which case an encoder should emit.
This parameter appears only on encoders where both cases are canonical and decoding accepts either — currently bech32 and bech32m, where BIP-173 forbids mixed case and accepts either pure case, with the checksum defined over the lowercase form.
It is deliberately absent elsewhere, and the absence is the safety property:
to_base64urltakes no case, because base64url’s alphabet givesa–zandA–Zdistinct meanings. Converting the case of a base64url string destroys it.to_base32takes no case, because RFC 4648 §6 output is uppercase by definition and the decoder rejects anything else.to_hex/to_hex_upperstay two methods, because hex decoding is case-insensitive either way and the pair predates this type.
A caller therefore cannot ask for a case conversion that would corrupt the value — there is no parameter to pass.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Lower
Lowercase output. The canonical form for bech32 and bech32m.
Upper
Uppercase output. Valid per BIP-173, and the form used by key formats such as
age’s AGE-SECRET-KEY-….
Trait Implementations§
impl Copy for Case
impl Eq for Case
impl StructuralPartialEq for Case
Auto Trait Implementations§
impl Freeze for Case
impl RefUnwindSafe for Case
impl Send for Case
impl Sync for Case
impl Unpin for Case
impl UnsafeUnpin for Case
impl UnwindSafe for Case
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more