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