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
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
pub trait License {
    fn notice(&self, year: i32, name: &str, project: &str) -> String;
}

// agpl-3.0.txt
pub struct AGPL {}

impl License for AGPL {
    fn notice(&self, year: i32, name: &str, _project: &str) -> String {
        format!(include_str!("../files/agpl-3.0.txt"), YEAR = year, AUTHOR = name)
    }
}

// apache-2.0.txt
pub struct Apache {}

impl License for Apache {
    fn notice(&self, year: i32, name: &str, _project: &str) -> String {
        format!(include_str!("../files/apache-2.0.txt"), YEAR = year, AUTHOR = name)
    }
}

// bsd-3.0.txt
pub struct BSD {}

impl License for BSD {
    fn notice(&self, year: i32, name: &str, _project: &str) -> String {
        format!(include_str!("../files/bsd-3.0.txt"), YEAR = year, AUTHOR = name)
    }
}

// cc-by-4.0.txt
pub struct CcBy {}

impl License for CcBy {
    fn notice(&self, _year: i32, name: &str, project: &str) -> String {
        format!(include_str!("../files/cc-by-4.0.txt"), AUTHOR = name, PROJECT = project)
    }
}

// cc-by-nc-4.0.txt
pub struct CcByNc {}

impl License for CcByNc {
    fn notice(&self, _year: i32, name: &str, project: &str) -> String {
        format!(include_str!("../files/cc-by-nc-4.0.txt"), AUTHOR = name, PROJECT = project)
    }
}

// cc-by-nc-sa-4.0.txt
pub struct CcByNcSa {}

impl License for CcByNcSa {
    fn notice(&self, _year: i32, name: &str, project: &str) -> String {
        format!(include_str!("../files/cc-by-nc-sa-4.0.txt"), AUTHOR = name, PROJECT = project)
    }
}

// cc-by-sa-4.0.txt
pub struct CcBySa {}

impl License for CcBySa {
    fn notice(&self, _year: i32, name: &str, project: &str) -> String {
        format!(include_str!("../files/cc-by-sa-4.0.txt"), AUTHOR = name, PROJECT = project)
    }
}

// cc-zero-1.0.txt
pub struct CCZero {}

impl License for CCZero {
    fn notice(&self, _year: i32, name: &str, _project: &str) -> String {
        format!(include_str!("../files/cc-zero-1.0.txt"), AUTHOR = name)
    }
}

// gpl-3.0.txt
pub struct GPL {}

impl License for GPL {
    fn notice(&self, year: i32, name: &str, _project: &str) -> String {
        format!(include_str!("../files/gpl-3.0.txt"), YEAR = year, AUTHOR = name)
    }
}

// lgpl-3.0.txt
pub struct LGPL {}

impl License for LGPL {
    fn notice(&self, year: i32, name: &str, _project: &str) -> String {
        format!(include_str!("../files/lgpl-3.0.txt"), YEAR = year, AUTHOR = name)
    }
}

// mit.txt
pub struct Mit {}

impl License for Mit {
    fn notice(&self, year: i32, name: &str, _project: &str) -> String {
        format!(include_str!("../files/mit.txt"), YEAR = year, AUTHOR = name)
    }
}

// mpl-2.0.txt
pub struct MPL {}

impl License for MPL {
    fn notice(&self, year: i32, name: &str, _project: &str) -> String {
        format!(include_str!("../files/mpl-2.0.txt"), YEAR = year, AUTHOR = name)
    }
}

// unlicense.txt
pub struct UNLICENSE {}

impl License for UNLICENSE {
    fn notice(&self, _year: i32, _name: &str, _project: &str) -> String {
        include_str!("../files/unlicense.txt").to_string()
    }
}