Skip to content
This repository was archived by the owner on Apr 9, 2023. It is now read-only.

Upgrade to nom 4 #19

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ publish = false

[dependencies]
petgraph = "^0.5"
nom = "^3"
nom = "^4"
lazy_static = "^1.4"
fnv = "^1"

Expand Down
Binary file modified src/fdo_magic/builtin/magic
Binary file not shown.
10 changes: 2 additions & 8 deletions src/fdo_magic/ruleset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,9 @@ fn gen_graph(magic_rules: Vec<super::MagicRule>) -> DiGraph<super::MagicRule, u3
}

pub fn from_u8(b: &[u8]) -> Result<FnvHashMap<MIME, DiGraph<super::MagicRule, u32>>, String> {
let tuplevec = from_u8_to_tuple_vec(b).to_result().map_err(|e| e.to_string())?;
let mut res = FnvHashMap::<MIME, DiGraph<super::MagicRule, u32>>::default();

for x in tuplevec {
res.insert(x.0, gen_graph(x.1));
}

let tuplevec = from_u8_to_tuple_vec(b).map_err(|e| e.to_string())?.1;
let res = tuplevec.into_iter().map(|x| (x.0, gen_graph(x.1))).collect();
Ok(res)

}

/// Loads the given magic file and outputs a vector of MagicEntry structs
Expand Down