#[non_exhaustive]pub enum LanguageMatching {
Lookup,
BasicFilter,
}Expand description
How Accept-Language ranges are matched against offered tags.
§Examples
use parse_net::negotiate::{LanguageMatching, Negotiator};
let offers = ["en-US"];
assert_eq!(Negotiator::new().language(Some(b"en"), &offers).index(), None);
let filter = Negotiator::new().language_matching(LanguageMatching::BasicFilter);
assert_eq!(filter.language(Some(b"en"), &offers).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.
Lookup
RFC 4647 section 3.4 lookup: a range matches an offer equal to it or
reached by removing subtags from its end (en-US matches en).
BasicFilter
RFC 4647 section 3.3.1 basic filtering: a range matches an offer equal
to it or starting with it and - (en matches en-US).
Trait Implementations§
Source§impl Clone for LanguageMatching
impl Clone for LanguageMatching
impl Copy for LanguageMatching
Source§impl Debug for LanguageMatching
impl Debug for LanguageMatching
Source§impl Default for LanguageMatching
impl Default for LanguageMatching
impl Eq for LanguageMatching
Source§impl Hash for LanguageMatching
impl Hash for LanguageMatching
Source§impl PartialEq for LanguageMatching
impl PartialEq for LanguageMatching
impl StructuralPartialEq for LanguageMatching
Auto Trait Implementations§
impl Freeze for LanguageMatching
impl RefUnwindSafe for LanguageMatching
impl Send for LanguageMatching
impl Sync for LanguageMatching
impl Unpin for LanguageMatching
impl UnsafeUnpin for LanguageMatching
impl UnwindSafe for LanguageMatching
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