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 const MAX_LENGTH: usize = 127usize
pub const MAX_LENGTH: usize = 127usize
The maximum byte length of a name.
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 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 Ord for Name<'_>
impl Ord for Name<'_>
Source§impl PartialOrd<&Cow<'_, str>> for Name<'_>
impl PartialOrd<&Cow<'_, str>> for Name<'_>
Source§impl PartialOrd<&String> for Name<'_>
impl PartialOrd<&String> for Name<'_>
Source§impl PartialOrd<&str> for Name<'_>
impl PartialOrd<&str> for Name<'_>
Source§impl PartialOrd<Cow<'_, str>> for Name<'_>
impl PartialOrd<Cow<'_, str>> for Name<'_>
Source§impl PartialOrd<String> for Name<'_>
impl PartialOrd<String> for Name<'_>
Source§impl PartialOrd<str> for Name<'_>
impl PartialOrd<str> for Name<'_>
Source§impl PartialOrd for Name<'_>
impl PartialOrd for Name<'_>
impl<'a> Copy for Name<'a>
impl Eq for Name<'_>
Auto Trait Implementations§
impl<'a> Freeze for Name<'a>
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