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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
pub mod init; pub mod read; pub mod write; use std::path::PathBuf; use std::result::Result; use std::collections::HashMap; use std::ffi::OsString; #[derive(Debug)] pub struct NonInitializedRoot { pub path: PathBuf, pub name: String, pub cargo_toml: CargoToml, } #[derive(Debug)] pub struct Root { pub path: PathBuf, pub name: String, pub fuzz: Fuzz, pub cargo_toml: CargoToml, } #[derive(Debug)] pub struct Fuzz { pub non_instrumented: NonInstrumented, pub instrumented: Instrumented, pub corpora: Result<Corpora, read::CorporaError>, pub artifacts: Result<Artifacts, read::ArtifactsError>, pub gitignore: Option<String>, } #[derive(Debug)] pub struct NonInstrumented { pub src: SrcLibRs, pub fuzz_targets: FuzzTargets, pub build_rs: BuildRs, pub cargo_toml: CargoToml, } #[derive(Debug)] pub struct Instrumented { pub src: SrcLibRs, pub cargo_toml: CargoToml, } #[derive(Debug)] pub struct SrcLibRs { pub content: Vec<u8>, } #[derive(Debug)] pub struct Corpora { pub corpora: Vec<PathBuf>, } #[derive(Debug)] pub struct Artifacts { pub artifacts: Vec<PathBuf>, } #[derive(Debug)] pub struct BuildRs { pub content: Vec<u8>, } #[derive(Debug)] pub struct CargoToml { pub toml: toml::Value, } #[derive(Debug)] pub struct FuzzTargets { pub targets: HashMap<OsString, Vec<u8>>, } impl Root { pub fn fuzz_folder(&self) -> PathBuf { self.path.join("fuzz") } pub fn non_instrumented_folder(&self) -> PathBuf { self.fuzz_folder().join("non_instrumented") } pub fn instrumented_folder(&self) -> PathBuf { self.fuzz_folder().join("instrumented") } pub fn corpora_folder(&self) -> PathBuf { self.fuzz_folder().join("corpora") } pub fn artifacts_folder(&self) -> PathBuf { self.fuzz_folder().join("artifacts") } }