| 194 | } else if path.extension().and_then(|ext| ext.to_str()) == Some("build") { |
| 195 | out.push(path); |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | #[derive(Clone, Copy, PartialEq, Eq)] |
| 201 | enum Kind { |
| 202 | Tool, |
| 203 | Demo, |
| 204 | Example, |
| 205 | Fixture, |
| 206 | } |
| 207 | |
| 208 | impl Kind { |
| 209 | fn parse(value: &str) -> Self { |
| 210 | match value { |
| 211 | "tool" => Self::Tool, |
| 212 | "demo" => Self::Demo, |
| 213 | "example" => Self::Example, |
| 214 | "fixture" => Self::Fixture, |
| 215 | other => panic!("unknown program kind `{other}`"), |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | fn variant(self) -> &'static str { |
| 220 | match self { |
| 221 | Self::Tool => "Tool", |
| 222 | Self::Demo => "Demo", |
| 223 | Self::Example => "Example", |
| 224 | Self::Fixture => "Fixture", |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | fn rank(self) -> u8 { |
| 229 | self as u8 |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | struct Program { |
| 234 | name: String, |
| 235 | title: String, |
| 236 | description: String, |
| 237 | kind: Kind, |
| 238 | install_path: Option<String>, |
| 239 | source: String, |
| 240 | build_path: String, |
| 241 | import_closure: bool, |
| 242 | mangle_symbols: bool, |
| 243 | layout_const: Option<String>, |
| 244 | layout_path: Option<String>, |
| 245 | } |
| 246 | |