#[non_exhaustive]pub enum MalformedPolicy {
TreatAsAbsent,
Refuse,
}Expand description
What a selection does with a header that does not parse.
§Examples
use parse_net::negotiate::{MalformedPolicy, Negotiator, Outcome};
let bad = Some(&b"text/html;q=x"[..]);
assert_eq!(Negotiator::new().media(bad, &["text/html"]), Outcome::HeaderIgnored { index: 0 });
let strict = Negotiator::new().on_malformed(MalformedPolicy::Refuse);
assert!(matches!(strict.media(bad, &["text/html"]), Outcome::Refused(_)));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.
TreatAsAbsent
Treat the header as absent (RFC 9110 lets a server ignore it) and say
so with Outcome::HeaderIgnored.
Refuse
Report Outcome::Refused, so the caller can answer 400.
Trait Implementations§
Source§impl Clone for MalformedPolicy
impl Clone for MalformedPolicy
impl Copy for MalformedPolicy
Source§impl Debug for MalformedPolicy
impl Debug for MalformedPolicy
Source§impl Default for MalformedPolicy
impl Default for MalformedPolicy
impl Eq for MalformedPolicy
Source§impl Hash for MalformedPolicy
impl Hash for MalformedPolicy
Source§impl PartialEq for MalformedPolicy
impl PartialEq for MalformedPolicy
impl StructuralPartialEq for MalformedPolicy
Auto Trait Implementations§
impl Freeze for MalformedPolicy
impl RefUnwindSafe for MalformedPolicy
impl Send for MalformedPolicy
impl Sync for MalformedPolicy
impl Unpin for MalformedPolicy
impl UnsafeUnpin for MalformedPolicy
impl UnwindSafe for MalformedPolicy
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