started package deserialization
This commit is contained in:
parent
156558c44f
commit
f2e78523ea
2 changed files with 25 additions and 3 deletions
|
@ -4,8 +4,8 @@ version = 100
|
||||||
key = ""
|
key = ""
|
||||||
[files]
|
[files]
|
||||||
"/opt/etc" = { match = "etc/*", tracked = false }
|
"/opt/etc" = { match = "etc/*", tracked = false }
|
||||||
"/opt/etc/enby/manuals" = "manual.gmi"
|
"/opt/etc/enby/manuals" = { path = "manual.gmi", name = "example-package.gmi"}
|
||||||
"/opt/bin" = { file = "example-package.x86-64.elf", name = "example-package"}
|
"/opt/bin" = { file = "example-package.x86-64.elf", name = "example-package", bin = "x86-64-elf"}
|
||||||
[locale.en_US]
|
[locale.en_US]
|
||||||
name = "Example Package"
|
name = "Example Package"
|
||||||
description = "Example Package for testing GayPackage format."
|
description = "Example Package for testing GayPackage format."
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use toml::map::Map;
|
||||||
use toml::value::Table;
|
use toml::value::Table;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -7,5 +8,26 @@ pub struct PackageData {
|
||||||
name: String,
|
name: String,
|
||||||
version: u64,
|
version: u64,
|
||||||
key: String,
|
key: String,
|
||||||
files: Table,
|
files: Map<String, PackageFile>,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct PackageFile {
|
||||||
|
match_: Option<String>,
|
||||||
|
tracked: Option<bool>,
|
||||||
|
file: String,
|
||||||
|
folder: Option<bool>,
|
||||||
|
name: Option<String>,
|
||||||
|
bin: Option<String>
|
||||||
|
}
|
||||||
|
impl Default for PackageFile {
|
||||||
|
fn default() -> Self {
|
||||||
|
PackageFile {
|
||||||
|
match_: None,
|
||||||
|
tracked: Some(true),
|
||||||
|
file: "".to_string(),
|
||||||
|
folder: Some(false),
|
||||||
|
name: None,
|
||||||
|
bin: None
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue