[go: up one dir, main page]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use std::fmt::{self, Display, Formatter};
use std::ffi::OsStr;
use License;
use permissions::*;
use conditions::*;
use limitations::*;

/// The [GNU Lesser General Public License v3.0](http://www.gnu.org/licenses/lgpl-3.0).
#[derive(Clone, Copy, Debug, Default, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub struct Lgpl3;

impl License for Lgpl3 {
    #[inline]
    fn name(&self) -> &str {
        "GNU General Public License v3.0 only"
    }

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

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

    #[inline]
    fn text(&self) -> &str {
        include_str!("../files/LGPL-3")
    }

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

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

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

    #[inline]
    fn homepage(&self) -> Option<&str> {
        Some("http://www.gnu.org/licenses/lgpl-3.0")
    }
}

impl Display for Lgpl3 {
    #[inline]
    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
        write!(f, "{}", self.text())
    }
}

impl AsRef<str> for Lgpl3 {
    #[inline]
    fn as_ref(&self) -> &str {
        self.text()
    }
}

impl AsRef<OsStr> for Lgpl3 {
    #[inline]
    fn as_ref(&self) -> &OsStr {
        self.text().as_ref()
    }
}

impl AsRef<[u8]> for Lgpl3 {
    #[inline]
    fn as_ref(&self) -> &[u8] {
        self.text().as_bytes()
    }
}