pub struct BoundedName<const N: usize>(/* private fields */);
Expand description
A BoundedName
is a Name
that can have a max length of N
bytes.
Implementations§
Source§impl<const N: usize> BoundedName<N>
impl<const N: usize> BoundedName<N>
Sourcepub fn new(name: impl AsRef<str> + Into<String>) -> Result<Self, ParseError>
pub fn new(name: impl AsRef<str> + Into<String>) -> Result<Self, ParseError>
Creates a BoundedName
from a String
, returning an Err
if the string
fails validation. The string must be non-empty, no more than N
characters in length, and consist of one or more of the
following characters: A-Z
, a-z
, 0-9
, _
, .
, -
. It may not start
with .
or -
.
pub fn as_str(&self) -> &str
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Trait Implementations§
Source§impl<const N: usize> Clone for BoundedName<N>
impl<const N: usize> Clone for BoundedName<N>
Source§fn clone(&self) -> BoundedName<N>
fn clone(&self) -> BoundedName<N>
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<const N: usize> Debug for BoundedName<N>
impl<const N: usize> Debug for BoundedName<N>
Source§impl<'de, const N: usize> Deserialize<'de> for BoundedName<N>
impl<'de, const N: usize> Deserialize<'de> for BoundedName<N>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<const N: usize> Display for BoundedName<N>
impl<const N: usize> Display for BoundedName<N>
Source§impl<'a, const N: usize> From<&'a BoundedName<N>> for &'a FlyStr
impl<'a, const N: usize> From<&'a BoundedName<N>> for &'a FlyStr
Source§fn from(o: &'a BoundedName<N>) -> Self
fn from(o: &'a BoundedName<N>) -> Self
Converts to this type from the input type.
Source§impl From<BoundedName<MAX_NAME_LENGTH>> for LongName
impl From<BoundedName<MAX_NAME_LENGTH>> for LongName
Source§impl<'a, const N: usize> From<BoundedName<N>> for FlyStr
impl<'a, const N: usize> From<BoundedName<N>> for FlyStr
Source§fn from(o: BoundedName<N>) -> Self
fn from(o: BoundedName<N>) -> Self
Converts to this type from the input type.
Source§impl<const N: usize> From<BoundedName<N>> for String
impl<const N: usize> From<BoundedName<N>> for String
Source§fn from(name: BoundedName<N>) -> String
fn from(name: BoundedName<N>) -> String
Converts to this type from the input type.
Source§impl<const N: usize> FromStr for BoundedName<N>
impl<const N: usize> FromStr for BoundedName<N>
Source§impl<const N: usize> Hash for BoundedName<N>
impl<const N: usize> Hash for BoundedName<N>
Source§impl<const N: usize> Ord for BoundedName<N>
impl<const N: usize> Ord for BoundedName<N>
Source§fn cmp(&self, other: &BoundedName<N>) -> Ordering
fn cmp(&self, other: &BoundedName<N>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const N: usize> PartialEq for BoundedName<N>
impl<const N: usize> PartialEq for BoundedName<N>
Source§impl<const N: usize> PartialOrd for BoundedName<N>
impl<const N: usize> PartialOrd for BoundedName<N>
Source§impl<const N: usize> Serialize for BoundedName<N>
impl<const N: usize> Serialize for BoundedName<N>
impl<const N: usize> Eq for BoundedName<N>
impl<const N: usize> StructuralPartialEq for BoundedName<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for BoundedName<N>
impl<const N: usize> RefUnwindSafe for BoundedName<N>
impl<const N: usize> Send for BoundedName<N>
impl<const N: usize> Sync for BoundedName<N>
impl<const N: usize> Unpin for BoundedName<N>
impl<const N: usize> UnwindSafe for BoundedName<N>
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
)