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<'a> Ord for Name<'a>
impl<'a> Ord for Name<'a>
source§impl<'a> PartialOrd<&Cow<'_, str>> for Name<'a>
impl<'a> PartialOrd<&Cow<'_, str>> for Name<'a>
source§impl<'a> PartialOrd<&String> for Name<'a>
impl<'a> PartialOrd<&String> for Name<'a>
source§impl<'a> PartialOrd<&str> for Name<'a>
impl<'a> PartialOrd<&str> for Name<'a>
source§impl<'a> PartialOrd<Cow<'_, str>> for Name<'a>
impl<'a> PartialOrd<Cow<'_, str>> for Name<'a>
source§impl<'a> PartialOrd<String> for Name<'a>
impl<'a> PartialOrd<String> for Name<'a>
source§impl<'a> PartialOrd<str> for Name<'a>
impl<'a> PartialOrd<str> for Name<'a>
source§impl<'a> PartialOrd for Name<'a>
impl<'a> PartialOrd for Name<'a>
impl<'a> Copy for Name<'a>
impl<'a> Eq for Name<'a>
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
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
)