pub struct License(/* private fields */);Expand description
A license governing the use and or distribution for a product.
Where available, SPDX short identifiers are preferred.
Implementations§
Source§impl License
impl License
pub const MIN_CHAR_LENGTH: usize = 3usize
pub const MAX_CHAR_LENGTH: usize = 512usize
Sourcepub const PROPRIETARY: Self
pub const PROPRIETARY: Self
Represents a proprietary license.
Use this when the license information for a package is unknown or not publicly available. Proprietary licenses typically restrict usage, modification, and redistribution.
Sourcepub const APACHE_V1_1: Self
pub const APACHE_V1_1: Self
Sourcepub const AGPL_V1_ONLY: Self
pub const AGPL_V1_ONLY: Self
Sourcepub const AGPL_V3_ONLY: Self
pub const AGPL_V3_ONLY: Self
Sourcepub const GPL_V1_ONLY: Self
pub const GPL_V1_ONLY: Self
Sourcepub const GPL_V2_ONLY: Self
pub const GPL_V2_ONLY: Self
Sourcepub const GPL_V3_ONLY: Self
pub const GPL_V3_ONLY: Self
Sourcepub fn new<T: AsRef<str> + Into<CompactString>>(
license: T,
) -> Result<Self, LicenseError>
pub fn new<T: AsRef<str> + Into<CompactString>>( license: T, ) -> Result<Self, LicenseError>
Creates a new License from any type that implements AsRef<str> and
Into<CompactString>.
§Errors
Returns an Err if the license is less than 3 characters long or more than 512 characters
long.
§Examples
use winget_types::locale::License;
let license = License::new("MIT")?;
assert_eq!(license.as_str(), "MIT");Sourcepub unsafe fn new_unchecked<T: Into<CompactString>>(license: T) -> Self
pub unsafe fn new_unchecked<T: Into<CompactString>>(license: T) -> Self
Creates a new License from any type that implements Into<CompactString> without checking
its validity.
§Safety
The license must not be less than 3 characters long or more than 512 characters long.
Trait Implementations§
Source§impl Ord for License
impl Ord for License
Source§impl PartialOrd for License
impl PartialOrd for License
Source§impl TryFrom<CompactString> for License
impl TryFrom<CompactString> for License
Source§type Error = LicenseError
type Error = LicenseError
The type returned in the event of a conversion error.
impl Eq for License
impl StructuralPartialEq for License
Auto Trait Implementations§
impl Freeze for License
impl RefUnwindSafe for License
impl Send for License
impl Sync for License
impl Unpin for License
impl UnwindSafe for License
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