pub struct Name<'a>(/* private fields */);
Expand description
A media-type name.
A valid name has the following requirements:
- The first character must be an alphabet or a number.
- The subsequent characters must be alphabets, numbers or
!#$&-^_.+%*'
. - Length of the name can not exceed 127 bytes.
Implementations§
source§impl<'a> Name<'a>
impl<'a> Name<'a>
sourcepub fn new(s: &'a str) -> Option<Self>
pub fn new(s: &'a str) -> Option<Self>
Constructs a Name
.
If the string is not valid as a name, returns None
.
sourcepub const MAX_LENGTH: usize = 127usize
pub const MAX_LENGTH: usize = 127usize
The maximum byte length of a name.
sourcepub const fn new_unchecked(s: &'a str) -> Self
pub const fn new_unchecked(s: &'a str) -> Self
Constructs a Name
without validation.
Trait Implementations§
source§impl<'a> Ord for Name<'a>
impl<'a> Ord for Name<'a>
source§impl<'a> PartialEq<&Cow<'_, str>> for Name<'a>
impl<'a> PartialEq<&Cow<'_, str>> for Name<'a>
source§impl<'a> PartialEq<&String> for Name<'a>
impl<'a> PartialEq<&String> for Name<'a>
source§impl<'a> PartialEq<&str> for Name<'a>
impl<'a> PartialEq<&str> for Name<'a>
source§impl<'a> PartialEq<Cow<'_, str>> for Name<'a>
impl<'a> PartialEq<Cow<'_, str>> for Name<'a>
source§impl<'a> PartialEq<Name<'a>> for Name<'a>
impl<'a> PartialEq<Name<'a>> for Name<'a>
source§impl<'a> PartialEq<String> for Name<'a>
impl<'a> PartialEq<String> for Name<'a>
source§impl<'a> PartialOrd<&Cow<'_, str>> for Name<'a>
impl<'a> PartialOrd<&Cow<'_, str>> for Name<'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 Name<'a>
impl<'a> PartialOrd<&String> for Name<'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 Name<'a>
impl<'a> PartialOrd<&str> for Name<'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 Name<'a>
impl<'a> PartialOrd<Cow<'_, str>> for Name<'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<Name<'a>> for Name<'a>
impl<'a> PartialOrd<Name<'a>> for Name<'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 Name<'a>
impl<'a> PartialOrd<String> for Name<'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 Name<'a>
impl<'a> PartialOrd<str> for Name<'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 Name<'a>
impl<'a> Eq for Name<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Name<'a>
impl<'a> Send for Name<'a>
impl<'a> Sync for Name<'a>
impl<'a> Unpin for Name<'a>
impl<'a> UnwindSafe for Name<'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