[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 [Creative Commons Zero v1.0 Universal](http://creativecommons.org/publicdomain/zero/1.0/).
#[derive(Clone, Copy, Debug, Default, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub struct Cc01;

impl License for Cc01 {
    #[inline]
    fn name(&self) -> &str {
        "Creative Commons Zero v1.0 Universal"
    }

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

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

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

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

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

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

    #[inline]
    fn homepage(&self) -> Option<&str> {
        Some("http://creativecommons.org/publicdomain/zero/1.0/")
    }
}

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

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

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

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