pub struct FileExtension(/* private fields */);Implementations§
Source§impl FileExtension
impl FileExtension
pub const MAX_CHAR_LENGTH: usize = 64usize
Sourcepub fn new<T: AsRef<str>>(file_extension: T) -> Result<Self, FileExtensionError>
pub fn new<T: AsRef<str>>(file_extension: T) -> Result<Self, FileExtensionError>
Creates a new FileExtension from any type that implements AsRef<str>.
Leading dots (.) are trimmed.
§Errors
Returns an Err if the file extension is empty, more than 64 characters long, or contains a
disallowed character (control or one of DISALLOWED_CHARACTERS).
§Examples
use winget_types::installer::FileExtension;
let extension = FileExtension::new("xml")?;
assert_eq!(extension.as_str(), "xml");Sourcepub unsafe fn new_unchecked<T: Into<CompactString>>(file_extension: T) -> Self
pub unsafe fn new_unchecked<T: Into<CompactString>>(file_extension: T) -> Self
Creates a new FileExtension from any type that implements Into<CompactString> without
checking its validity.
§Safety
The file extension must not be empty, be more than 64 characters long, or contain a
disallowed character (control or one of DISALLOWED_CHARACTERS).
Trait Implementations§
Source§impl AsRef<str> for FileExtension
impl AsRef<str> for FileExtension
Source§impl Clone for FileExtension
impl Clone for FileExtension
Source§fn clone(&self) -> FileExtension
fn clone(&self) -> FileExtension
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 FileExtension
impl Debug for FileExtension
Source§impl Display for FileExtension
impl Display for FileExtension
Source§impl FromStr for FileExtension
impl FromStr for FileExtension
Source§impl Hash for FileExtension
impl Hash for FileExtension
Source§impl Ord for FileExtension
impl Ord for FileExtension
Source§fn cmp(&self, other: &FileExtension) -> Ordering
fn cmp(&self, other: &FileExtension) -> 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 FileExtension
impl PartialEq for FileExtension
Source§impl PartialOrd for FileExtension
impl PartialOrd for FileExtension
Source§impl TryFrom<CompactString> for FileExtension
impl TryFrom<CompactString> for FileExtension
Source§type Error = FileExtensionError
type Error = FileExtensionError
The type returned in the event of a conversion error.
impl Eq for FileExtension
impl StructuralPartialEq for FileExtension
Auto Trait Implementations§
impl Freeze for FileExtension
impl RefUnwindSafe for FileExtension
impl Send for FileExtension
impl Sync for FileExtension
impl Unpin for FileExtension
impl UnwindSafe for FileExtension
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