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
81
82
83
84
85
86
87
//! A license library.

extern crate aho_corasick;
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate lazy_static;

#[macro_use]
mod macros;

mod agpl3;
mod apache2;
mod cc01;
mod gpl3;
mod kind;
mod lgpl3;
mod license;
mod mit;
mod mpl2;
mod unknown;
mod unlicense;

pub use agpl3::Agpl3;
pub use apache2::Apache2;
pub use cc01::Cc01;
pub use gpl3::Gpl3;
pub use kind::Kind;
pub use lgpl3::Lgpl3;
pub use license::License;
pub use mit::Mit;
pub use mpl2::Mpl2;
pub use unknown::Unknown;
pub use unlicense::Unlicense;

pub mod permissions {
    bitflags! {
        /// The permissions of the license.
        pub struct Permissions: u8 {
            /// May be used for commercial purposes.
            const COMMERCIAL_USE = 0b_0000_0001;
            /// May be distributed.
            const DISTRIBUTION = 0b_0000_0010;
            /// May be modified.
            const MODIFICATION = 0b_0000_0100;
            /// Provides an express grant of patent rights from contributors.
            const PATENT_RIGHTS = 0b_0000_1000;
            /// May be used for private purposes.
            const PRIVATE_USE = 0b_0001_0000;
        }
    }
}

pub mod conditions {
    bitflags! {
        /// The conditions of the license.
        pub struct Conditions: u8 {
            /// Source code must be made available when the software is distributed.
            const DISCLOSE_SOURCES = 0b_0000_0001;
            /// Changes made to the code must be documented.
            const DOCUMENT_CHANGES = 0b_0000_0010;
            /// The license and copyright notice must be included with the software.
            const LICENSE_AND_COPYRIGHT_NOTICE = 0b_0000_0100;
            /// Users who interact with the software via network are
            /// given the right to receive a copy of the source code.
            const NETWORK_USE_IS_DISTRIBUTION = 0b_0000_1000;
            /// Modifications must be released under the same license.
            const SAME_LICENSE = 0b_0001_0000;
        }
    }
}

pub mod limitations {
    bitflags! {
        /// The limitations of the license.
        pub struct Limitations: u8 {
            /// Includes a limitation of liability.
            const NO_LIABILITY = 0b_0000_0001;
            /// Does not grant trademark rights.
            const NO_TRADEMARK_RIGHTS = 0b_0000_0010;
            /// Does not provide any warranty.
            const NO_WARRANTY = 0b_0000_0100;
            /// Does not provide any rights in the patents of contributors.
            const NO_PATENT_RIGHTS = 0b_0000_1000;
        }
    }
}