pub struct Value<'a>(/* private fields */);
Expand description
A media-type parameter value.
The constructor accepts both an unquoted string and a quoted string like "Hello Wold!"
.
If the string is not quoted, the allowed characters are
alphabets, numbers and !#$&-^_.+%*'
.
let utf8 = Value::new("UTF-8").unwrap();
let utf8_quoted = Value::new("\"UTF-8\"").unwrap();
assert_eq!(utf8, utf8_quoted);
assert_eq!(utf8_quoted.as_str(), "\"UTF-8\"");
assert_eq!(utf8_quoted.unquoted_str(), "UTF-8");
let double_quoted = Value::new("\" \\\" \"").unwrap();
assert_eq!(double_quoted.as_str(), "\" \\\" \"");
assert_eq!(double_quoted.unquoted_str(), " \" ");
Implementations§
Trait Implementations§
source§impl<'a> Ord for Value<'a>
impl<'a> Ord for Value<'a>
source§impl<'a> PartialEq<&Cow<'_, str>> for Value<'a>
impl<'a> PartialEq<&Cow<'_, str>> for Value<'a>
source§impl<'a> PartialEq<&String> for Value<'a>
impl<'a> PartialEq<&String> for Value<'a>
source§impl<'a> PartialEq<&str> for Value<'a>
impl<'a> PartialEq<&str> for Value<'a>
source§impl<'a> PartialEq<Cow<'_, str>> for Value<'a>
impl<'a> PartialEq<Cow<'_, str>> for Value<'a>
source§impl<'a> PartialEq<String> for Value<'a>
impl<'a> PartialEq<String> for Value<'a>
source§impl<'a> PartialEq for Value<'a>
impl<'a> PartialEq for Value<'a>
source§impl<'a> PartialOrd<&Cow<'_, str>> for Value<'a>
impl<'a> PartialOrd<&Cow<'_, str>> for Value<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> PartialOrd<&String> for Value<'a>
impl<'a> PartialOrd<&String> for Value<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> PartialOrd<&str> for Value<'a>
impl<'a> PartialOrd<&str> for Value<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> PartialOrd<Cow<'_, str>> for Value<'a>
impl<'a> PartialOrd<Cow<'_, str>> for Value<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> PartialOrd<String> for Value<'a>
impl<'a> PartialOrd<String> for Value<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> PartialOrd<str> for Value<'a>
impl<'a> PartialOrd<str> for Value<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> PartialOrd for Value<'a>
impl<'a> PartialOrd for Value<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<'a> Copy for Value<'a>
impl<'a> Eq for Value<'a>
Auto Trait Implementations§
impl<'a> Freeze for Value<'a>
impl<'a> RefUnwindSafe for Value<'a>
impl<'a> Send for Value<'a>
impl<'a> Sync for Value<'a>
impl<'a> Unpin for Value<'a>
impl<'a> UnwindSafe for Value<'a>
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)