#[non_exhaustive]pub enum Outcome {
Chosen {
index: usize,
weight: QValue,
},
NoneAcceptable,
HeaderIgnored {
index: usize,
},
Refused(ParseError),
}Expand description
The result of a selection.
§Examples
use parse_net::{negotiate::{Negotiator, Outcome}, QValue};
let n = Negotiator::new();
assert_eq!(n.media(Some(b"text/html"), &["text/html"]), Outcome::Chosen { index: 0, weight: QValue::ONE });
assert_eq!(n.media(Some(b"image/png"), &["text/html"]), Outcome::NoneAcceptable);
assert_eq!(n.media(Some(b"text/html;q=9"), &["text/html"]).index(), Some(0));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.
Chosen
The offer at index is the best, with this weight.
NoneAcceptable
No offer is acceptable: answer 406, or send a default.
HeaderIgnored
The header did not parse and was treated as absent; the offer at
index (the first) is chosen.
Refused(ParseError)
The header did not parse, and the policy is to refuse it.
Implementations§
Trait Implementations§
impl Copy for Outcome
impl Eq for Outcome
impl StructuralPartialEq for Outcome
Auto Trait Implementations§
impl Forget for Outcome
impl Freeze for Outcome
impl RefUnwindSafe for Outcome
impl Send for Outcome
impl Sync for Outcome
impl Unpin for Outcome
impl UnsafeUnpin for Outcome
impl UnwindSafe for Outcome
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