license 0.3.0

A license library.
Documentation
use License;
use permissions::*;
use conditions::*;
use limitations::*;

/// The [MIT License](https://opensource.org/licenses/MIT).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub struct Mit(pub(crate) String);

impl Mit {
    /// Returns a MIT license.
    #[inline]
    pub fn new(year: i32, name: &str) -> Mit {
        Mit(format!(include_str!("../files/MIT"), year, name))
    }
}

impl License for Mit {
    #[inline]
    fn name(&self) -> &str {
        "MIT License"
    }

    #[inline]
    fn id(&self) -> &str {
        "MIT"
    }

    #[inline]
    fn is_osi_approved(&self) -> bool {
        true
    }

    #[inline]
    fn text(&self) -> &str {
        &self.0
    }

    #[inline]
    fn permissions(&self) -> Permissions {
        COMMERCIAL_USE | DISTRIBUTION | MODIFICATION | PRIVATE_USE
    }

    #[inline]
    fn conditions(&self) -> Conditions {
        LICENSE_AND_COPYRIGHT_NOTICE
    }

    #[inline]
    fn limitations(&self) -> Limitations {
        NO_LIABILITY | NO_WARRANTY
    }

    #[inline]
    fn homepage(&self) -> Option<&str> {
        Some("https://opensource.org/licenses/MIT")
    }
}

impl Default for Mit {
    #[inline]
    fn default() -> Self {
        Mit(format!(include_str!("../files/MIT"), "<year>", "<name>"))
    }
}

impl_license!(Mit);