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
use std::path::Path;
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum SourcePackageLayout {
Sources,
Specifications,
Tests,
Scripts,
Examples,
Manifest,
}
impl SourcePackageLayout {
pub fn path(&self) -> &Path {
Path::new(self.location_str())
}
pub fn location_str(&self) -> &'static str {
match self {
Self::Sources => "sources",
Self::Manifest => "Move.toml",
Self::Tests => "tests",
Self::Scripts => "scripts",
Self::Examples => "examples",
Self::Specifications => "specifications",
}
}
pub fn is_optional(&self) -> bool {
match self {
Self::Sources | Self::Manifest => false,
Self::Tests | Self::Scripts | Self::Examples | Self::Specifications => true,
}
}
}