#[non_exhaustive]pub enum HeaderError {
Reserved {
key: String,
},
EmptyKey,
ControlCharacterInKey {
key: String,
},
ControlCharacterInValue {
key: String,
},
KeyTooLong {
len: usize,
},
ValueTooLong {
len: usize,
},
TooManyHeaders {
limit: usize,
},
}Expand description
Headers::insert failures.
use reliar_core::{HeaderError, Headers};
let mut headers = Headers::default();
let err = headers.insert("reliar-anything", "nope").unwrap_err();
assert!(matches!(err, HeaderError::Reserved { .. }));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.
Reserved
The key starts with the reserved reliar- prefix (case-insensitive).
EmptyKey
The key was empty.
ControlCharacterInKey
The key contained a control character (including CR/LF — a header-injection surface).
ControlCharacterInValue
The value for this key contained a control character (including CR/LF). The value itself is never carried on the error — it may be a secret; the key is, so the caller can tell which header was rejected.
KeyTooLong
The key exceeded Headers::MAX_KEY_LEN.
ValueTooLong
The value exceeded Headers::MAX_VALUE_LEN.
TooManyHeaders
Inserting a new key would exceed Headers::MAX_COUNT.
Trait Implementations§
Source§impl Clone for HeaderError
impl Clone for HeaderError
Source§fn clone(&self) -> HeaderError
fn clone(&self) -> HeaderError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HeaderError
impl Debug for HeaderError
Source§impl Display for HeaderError
impl Display for HeaderError
impl Eq for HeaderError
Source§impl Error for HeaderError
impl Error for HeaderError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for HeaderError
impl PartialEq for HeaderError
impl StructuralPartialEq for HeaderError
Auto Trait Implementations§
impl Freeze for HeaderError
impl RefUnwindSafe for HeaderError
impl Send for HeaderError
impl Sync for HeaderError
impl Unpin for HeaderError
impl UnsafeUnpin for HeaderError
impl UnwindSafe for HeaderError
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