diff options
Diffstat (limited to 'src/config/mod.rs')
| -rw-r--r-- | src/config/mod.rs | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs new file mode 100644 index 0000000..98ba9fb --- /dev/null +++ b/src/config/mod.rs | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | mod parse; | ||
| 2 | |||
| 3 | use std::path::Path; | ||
| 4 | |||
| 5 | pub struct Config { | ||
| 6 | groups: Vec<Group>, | ||
| 7 | } | ||
| 8 | |||
| 9 | pub struct Group { | ||
| 10 | includes: Vec<IncludeAction>, | ||
| 11 | links: Vec<LinkAction>, | ||
| 12 | copies: Vec<CopyAction>, | ||
| 13 | } | ||
| 14 | |||
| 15 | pub struct IncludeAction { | ||
| 16 | group: String, | ||
| 17 | } | ||
| 18 | |||
| 19 | pub struct LinkAction { | ||
| 20 | source: String, | ||
| 21 | target: String, | ||
| 22 | } | ||
| 23 | |||
| 24 | pub struct CopyAction { | ||
| 25 | source: String, | ||
| 26 | target: String, | ||
| 27 | } | ||
| 28 | |||
| 29 | pub fn parse(content: &str) -> std::io::Result<Config> { | ||
| 30 | todo!() | ||
| 31 | } | ||
| 32 | |||
| 33 | pub fn parse_path(path: impl AsRef<Path>) -> std::io::Result<Config> { | ||
| 34 | todo!() | ||
| 35 | } | ||
| 36 | |||
| 37 | pub fn format(content: &str) -> std::io::Result<String> { | ||
| 38 | todo!() | ||
| 39 | } | ||
| 40 | |||
| 41 | pub fn format_path(path: impl AsRef<Path>) -> std::io::Result<String> { | ||
| 42 | todo!() | ||
| 43 | } | ||
| 44 | |||
| 45 | pub fn format_inplace(path: impl AsRef<Path>) -> std::io::Result<()> { | ||
| 46 | todo!() | ||
| 47 | } | ||
| 48 | |||
| 49 | impl Config { | ||
| 50 | pub fn groups(&self) -> impl Iterator<Item = &Group> { | ||
| 51 | std::iter::empty() | ||
| 52 | } | ||
| 53 | |||
| 54 | pub fn group(&self, name: &str) -> Option<&Group> { | ||
| 55 | todo!() | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | impl Group { | ||
| 60 | pub fn groups(&self) -> impl Iterator<Item = &IncludeAction> { | ||
| 61 | std::iter::empty() | ||
| 62 | } | ||
| 63 | |||
| 64 | pub fn links(&self) -> impl Iterator<Item = &LinkAction> { | ||
| 65 | std::iter::empty() | ||
| 66 | } | ||
| 67 | |||
| 68 | pub fn copies(&self) -> impl Iterator<Item = &CopyAction> { | ||
| 69 | std::iter::empty() | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | impl IncludeAction { | ||
| 74 | pub fn name(&self) -> &str { | ||
| 75 | todo!() | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| 79 | impl LinkAction { | ||
| 80 | pub fn source(&self) -> &str { | ||
| 81 | todo!() | ||
| 82 | } | ||
| 83 | |||
| 84 | pub fn dest(&self) -> &str { | ||
| 85 | todo!() | ||
| 86 | } | ||
| 87 | } | ||
| 88 | |||
| 89 | impl CopyAction { | ||
| 90 | pub fn source(&self) -> &str { | ||
| 91 | todo!() | ||
| 92 | } | ||
| 93 | |||
| 94 | pub fn dest(&self) -> &str { | ||
| 95 | todo!() | ||
| 96 | } | ||
| 97 | } | ||
