pub struct PackageIdentifier(/* private fields */);Implementations§
Source§impl PackageIdentifier
impl PackageIdentifier
pub const MAX_CHAR_LENGTH: usize = 128usize
pub const MIN_PARTS: usize = 2usize
pub const MAX_PARTS: usize = 8usize
pub const MAX_PART_CHAR_LENGTH: usize = 32usize
Sourcepub fn new<T: AsRef<str> + Into<CompactString>>(
identifier: T,
) -> Result<Self, PackageIdentifierError>
pub fn new<T: AsRef<str> + Into<CompactString>>( identifier: T, ) -> Result<Self, PackageIdentifierError>
Creates a new PackageIdentifier from any type that implements AsRef<str> and
Into<CompactString>.
§Errors
Will return Err if the package identifier:
- Is empty
- Has an empty part
- Is more than 128 characters long
- Has a part more than 32 characters long
- Contains a disallowed character (control, whitespace, or one of
DISALLOWED_CHARACTERS)
Sourcepub unsafe fn new_unchecked<T: Into<CompactString>>(identifier: T) -> Self
pub unsafe fn new_unchecked<T: Into<CompactString>>(identifier: T) -> Self
Creates a new PackageIdentifier from any type that implements Into<CompactString>
without checking its validity.
§Safety
The package identifier must not:
- Be empty
- Have an empty part
- Be more than 128 characters long
- Have a part more than 32 characters long
- Contain a disallowed character (control, whitespace, or one of
DISALLOWED_CHARACTERS)
Trait Implementations§
Source§impl Clone for PackageIdentifier
impl Clone for PackageIdentifier
Source§fn clone(&self) -> PackageIdentifier
fn clone(&self) -> PackageIdentifier
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 Debug for PackageIdentifier
impl Debug for PackageIdentifier
Source§impl Default for PackageIdentifier
impl Default for PackageIdentifier
Source§fn default() -> PackageIdentifier
fn default() -> PackageIdentifier
Returns the “default value” for a type. Read more
Source§impl Display for PackageIdentifier
impl Display for PackageIdentifier
Source§impl FromStr for PackageIdentifier
impl FromStr for PackageIdentifier
Source§impl Hash for PackageIdentifier
impl Hash for PackageIdentifier
Source§impl Ord for PackageIdentifier
impl Ord for PackageIdentifier
Source§fn cmp(&self, other: &PackageIdentifier) -> Ordering
fn cmp(&self, other: &PackageIdentifier) -> 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 PartialEq for PackageIdentifier
impl PartialEq for PackageIdentifier
Source§impl PartialOrd for PackageIdentifier
impl PartialOrd for PackageIdentifier
Source§impl TryFrom<CompactString> for PackageIdentifier
impl TryFrom<CompactString> for PackageIdentifier
Source§type Error = PackageIdentifierError
type Error = PackageIdentifierError
The type returned in the event of a conversion error.
impl Eq for PackageIdentifier
impl StructuralPartialEq for PackageIdentifier
Auto Trait Implementations§
impl Freeze for PackageIdentifier
impl RefUnwindSafe for PackageIdentifier
impl Send for PackageIdentifier
impl Sync for PackageIdentifier
impl Unpin for PackageIdentifier
impl UnwindSafe for PackageIdentifier
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more