parser complete
This commit is contained in:
commit
8ffd3b9aff
12 changed files with 1321 additions and 0 deletions
13
parser/Cargo.toml
Normal file
13
parser/Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
[package]
|
||||
name = "nix_json_parser"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
crate-type = [ "lib" ]
|
||||
|
||||
[lib]
|
||||
path = "./lib.rs"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_repr = "0.1.20"
|
||||
|
61
parser/lib.rs
Normal file
61
parser/lib.rs
Normal file
|
@ -0,0 +1,61 @@
|
|||
use serde::Deserialize;
|
||||
use serde_repr::Deserialize_repr;
|
||||
|
||||
#[derive(Deserialize_repr, Debug)]
|
||||
#[repr(u8)]
|
||||
pub enum Activities {
|
||||
Unknown = 0,
|
||||
CopyPath = 100,
|
||||
FileTransfer = 101,
|
||||
Realise = 102,
|
||||
CopyPaths = 103,
|
||||
Builds = 104,
|
||||
Build = 105,
|
||||
OptimiseStore = 106,
|
||||
VerifyPath = 107,
|
||||
Substitute = 108,
|
||||
QueryPathInfo = 109,
|
||||
PostBuildHook = 110,
|
||||
BuildWaiting = 111,
|
||||
FetchTree = 112,
|
||||
}
|
||||
|
||||
#[derive(Deserialize_repr, Debug)]
|
||||
#[repr(u8)]
|
||||
pub enum Verbosity {
|
||||
Error = 0,
|
||||
Warning = 1,
|
||||
Notice = 2,
|
||||
Info = 3,
|
||||
Talkative = 4,
|
||||
Chatty = 5,
|
||||
Debug = 6,
|
||||
Vomit = 7,
|
||||
}
|
||||
|
||||
pub type Id = u64;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[serde(tag = "action")]
|
||||
pub enum Actions {
|
||||
#[serde(rename = "start")]
|
||||
Start {
|
||||
id: Id,
|
||||
level: Verbosity,
|
||||
parent: Id,
|
||||
text: String,
|
||||
#[serde(rename = "type")]
|
||||
activity: Activities,
|
||||
},
|
||||
#[serde(rename = "stop")]
|
||||
Stop { id: Id },
|
||||
#[serde(rename = "msg")]
|
||||
Message { level: Verbosity, msg: String },
|
||||
#[serde(rename = "result")]
|
||||
Result {
|
||||
fields: Vec<u8>,
|
||||
id: Id,
|
||||
#[serde(rename = "type")]
|
||||
activity: Activities,
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue