pub struct PackageName(/* private fields */);Implementations§
Source§impl PackageName
impl PackageName
pub const MIN_CHAR_LENGTH: usize = 2usize
pub const MAX_CHAR_LENGTH: usize = 256usize
Sourcepub fn new<T: AsRef<str> + Into<CompactString>>(
package_name: T,
) -> Result<Self, PackageNameError>
pub fn new<T: AsRef<str> + Into<CompactString>>( package_name: T, ) -> Result<Self, PackageNameError>
Creates a new PackageName from any type that implements AsRef<str> and
Into<CompactString>.
§Errors
Returns an Err if the package name is less than 2 characters long or more than 256
characters long.
§Examples
use winget_types::locale::PackageName;
let package_name = PackageName::new("PowerShell")?;
assert_eq!(package_name.as_str(), "PowerShell");Sourcepub unsafe fn new_unchecked<T: Into<CompactString>>(package_name: T) -> Self
pub unsafe fn new_unchecked<T: Into<CompactString>>(package_name: T) -> Self
Creates a new PackageName from any type that implements Into<CompactString> without
checking its validity.
§Safety
The package name must not be less than 2 characters long or more than 256 characters long.
Trait Implementations§
Source§impl AsRef<str> for PackageName
impl AsRef<str> for PackageName
Source§impl Clone for PackageName
impl Clone for PackageName
Source§fn clone(&self) -> PackageName
fn clone(&self) -> PackageName
Returns a duplicate 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 PackageName
impl Debug for PackageName
Source§impl Default for PackageName
impl Default for PackageName
Source§impl Display for PackageName
impl Display for PackageName
Source§impl FromStr for PackageName
impl FromStr for PackageName
Source§impl Hash for PackageName
impl Hash for PackageName
Source§impl Ord for PackageName
impl Ord for PackageName
Source§fn cmp(&self, other: &PackageName) -> Ordering
fn cmp(&self, other: &PackageName) -> 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 PackageName
impl PartialEq for PackageName
Source§impl PartialOrd for PackageName
impl PartialOrd for PackageName
Source§impl TryFrom<CompactString> for PackageName
impl TryFrom<CompactString> for PackageName
Source§type Error = PackageNameError
type Error = PackageNameError
The type returned in the event of a conversion error.
impl Eq for PackageName
impl StructuralPartialEq for PackageName
Auto Trait Implementations§
impl Freeze for PackageName
impl RefUnwindSafe for PackageName
impl Send for PackageName
impl Sync for PackageName
impl Unpin for PackageName
impl UnwindSafe for PackageName
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