Enum license::LicenseKind
[−]
[src]
pub enum LicenseKind { Apache2(Apache2), Gpl3(Gpl3), Mit(Mit), Mpl2(Mpl2), Unlicense(Unlicense), }
Enum containing all supported licenses.
Examples
use std::str::FromStr; use license::{Apache2, Gpl3, LicenseKind, Mit, Mpl2, Unlicense}; let apache2 = LicenseKind::from_str(include_str!("files/APACHE-2")); assert_eq!(apache2, Ok(LicenseKind::Apache2(Apache2))); let gpl3 = LicenseKind::from_str(include_str!("files/GPL-3")); assert_eq!(gpl3, Ok(LicenseKind::Gpl3(Gpl3))); let mit = LicenseKind::from_str(&format!(include_str!("files/MIT"), 2017, "Mr. Foo Bar")); assert_eq!(mit, Ok(LicenseKind::Mit(Mit::new(2017, "Mr. Foo Bar")))); let mpl2 = LicenseKind::from_str(include_str!("files/MPL-2")); assert_eq!(mpl2, Ok(LicenseKind::Mpl2(Mpl2))); let unlicense = LicenseKind::from_str(include_str!("files/UNLICENSE")); assert_eq!(unlicense, Ok(LicenseKind::Unlicense(Unlicense)));
Variants
Apache2(Apache2)
Gpl3(Gpl3)
Mit(Mit)
Mpl2(Mpl2)
Unlicense(Unlicense)
Methods
impl LicenseKind
[src]
fn from_id(s: &str) -> Result<LicenseKind, Unknown>
Trait Implementations
impl Clone for LicenseKind
[src]
fn clone(&self) -> LicenseKind
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for LicenseKind
[src]
impl Eq for LicenseKind
[src]
impl PartialEq for LicenseKind
[src]
fn eq(&self, __arg_0: &LicenseKind) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &LicenseKind) -> bool
This method tests for !=
.
impl Hash for LicenseKind
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for LicenseKind
[src]
fn cmp(&self, __arg_0: &LicenseKind) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialOrd for LicenseKind
[src]
fn partial_cmp(&self, __arg_0: &LicenseKind) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &LicenseKind) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &LicenseKind) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &LicenseKind) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &LicenseKind) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl License for LicenseKind
[src]
fn name(&self) -> &str
The name of the license. Read more
fn id(&self) -> &str
The identifier of the license. Read more
fn is_osi_approved(&self) -> bool
Says if the license is OSI approved. Read more
fn text(&self) -> &str
The license text.
fn permissions(&self) -> Permissions
The permissions of the license.
fn conditions(&self) -> Conditions
The conditions of the license.
fn limitations(&self) -> Limitations
The limitations of the license.
fn homepage(&self) -> Option<&str>
The homepage of the license.
impl FromStr for LicenseKind
[src]
type Err = Unknown
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a string s
to return a value of this type. Read more