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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
use crate::core; #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct ReleaseMetadata<'a> { pub copyright: &'a str, pub description: &'a str, pub engine: &'a str, pub engine_version: &'a str, pub patchlevel: &'a str, pub platform: &'a str, pub release_date: &'a str, pub revision: &'a str, pub ruby_version: &'a str, pub compiler_version: Option<&'a str>, } impl<'a> Default for ReleaseMetadata<'a> { fn default() -> Self { Self::new() } } impl<'a> core::ReleaseMetadata for ReleaseMetadata<'a> { fn ruby_copyright(&self) -> &str { self.copyright } fn ruby_description(&self) -> &str { self.description } fn ruby_engine(&self) -> &str { self.engine } fn ruby_engine_version(&self) -> &str { self.engine_version } fn ruby_patchlevel(&self) -> &str { self.patchlevel } fn ruby_platform(&self) -> &str { self.platform } fn ruby_release_date(&self) -> &str { self.release_date } fn ruby_revision(&self) -> &str { self.revision } fn ruby_version(&self) -> &str { self.ruby_version } fn artichoke_compiler_version(&self) -> Option<&str> { self.compiler_version } } impl<'a> ReleaseMetadata<'a> { #[must_use] pub const fn new() -> Self { Self { copyright: "Copyright (c) 2019 Ryan Lopopolo <rjl@hyperbo.la>", description: "Artichoke Ruby", engine: "artichoke-mruby", engine_version: env!("CARGO_PKG_VERSION"), patchlevel: "0", platform: "host", release_date: "", revision: "1", ruby_version: "2.6.3", compiler_version: Some("rustc"), } } #[must_use] pub fn with_ruby_copyright(mut self, copyright: &'a str) -> Self { self.copyright = copyright; self } #[must_use] pub fn with_ruby_description(mut self, description: &'a str) -> Self { self.description = description; self } #[must_use] pub fn with_ruby_engine(mut self, engine: &'a str) -> Self { self.engine = engine; self } #[must_use] pub fn with_ruby_engine_version(mut self, engine_version: &'a str) -> Self { self.engine_version = engine_version; self } #[must_use] pub fn with_ruby_patchlevel(mut self, patchlevel: &'a str) -> Self { self.patchlevel = patchlevel; self } #[must_use] pub fn with_ruby_platform(mut self, platform: &'a str) -> Self { self.platform = platform; self } #[must_use] pub fn with_ruby_release_date(mut self, release_date: &'a str) -> Self { self.release_date = release_date; self } #[must_use] pub fn with_ruby_revision(mut self, revision: &'a str) -> Self { self.revision = revision; self } #[must_use] pub fn with_ruby_version(mut self, ruby_version: &'a str) -> Self { self.ruby_version = ruby_version; self } #[must_use] pub fn with_artichoke_compiler_version(mut self, compiler_version: Option<&'a str>) -> Self { self.compiler_version = compiler_version; self } #[must_use] pub const fn ruby_copyright(&self) -> &str { self.copyright } #[must_use] pub const fn ruby_description(&self) -> &str { self.description } #[must_use] pub const fn ruby_engine(&self) -> &str { self.engine } #[must_use] pub const fn ruby_engine_version(&self) -> &str { self.engine_version } #[must_use] pub const fn ruby_patchlevel(&self) -> &str { self.patchlevel } #[must_use] pub const fn ruby_platform(&self) -> &str { self.platform } #[must_use] pub const fn ruby_release_date(&self) -> &str { self.release_date } #[must_use] pub const fn ruby_revision(&self) -> &str { self.revision } #[must_use] pub const fn ruby_version(&self) -> &str { self.ruby_version } #[must_use] pub const fn artichoke_compiler_version(&self) -> Option<&str> { self.compiler_version } }