pub enum Preference<T> {
Any,
Specific(T),
}
Expand description
A wrapper for types used in header values where wildcard (*
) items are allowed but the
underlying type does not support them.
For example, we use the language-tags
crate for the AcceptLanguage
typed header but it does not parse *
successfully. On the other hand, the mime
crate, used
for Accept
, has first-party support for wildcard items so this wrapper is not
used in those header types.
Variants§
Implementations§
source§impl<T> Preference<T>
impl<T> Preference<T>
sourcepub fn is_specific(&self) -> bool
pub fn is_specific(&self) -> bool
Returns true if preference is the specific item (T
) variant.
Trait Implementations§
source§impl<T: Clone> Clone for Preference<T>
impl<T: Clone> Clone for Preference<T>
source§fn clone(&self) -> Preference<T>
fn clone(&self) -> Preference<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for Preference<T>
impl<T: Debug> Debug for Preference<T>
source§impl<T: Display> Display for Preference<T>
impl<T: Display> Display for Preference<T>
source§impl<T: FromStr> FromStr for Preference<T>
impl<T: FromStr> FromStr for Preference<T>
source§impl<T: Hash> Hash for Preference<T>
impl<T: Hash> Hash for Preference<T>
source§impl<T: PartialEq> PartialEq for Preference<T>
impl<T: PartialEq> PartialEq for Preference<T>
source§impl<T: PartialOrd> PartialOrd for Preference<T>
impl<T: PartialOrd> PartialOrd for Preference<T>
impl<T: Copy> Copy for Preference<T>
impl<T: Eq> Eq for Preference<T>
impl<T> StructuralPartialEq for Preference<T>
Auto Trait Implementations§
impl<T> Freeze for Preference<T>where
T: Freeze,
impl<T> RefUnwindSafe for Preference<T>where
T: RefUnwindSafe,
impl<T> Send for Preference<T>where
T: Send,
impl<T> Sync for Preference<T>where
T: Sync,
impl<T> Unpin for Preference<T>where
T: Unpin,
impl<T> UnwindSafe for Preference<T>where
T: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.