cargo_fixit/ops/
check.rs

1use rustfix::diagnostics::Diagnostic;
2use serde::Deserialize;
3
4#[derive(Deserialize, Debug)]
5#[serde(untagged)]
6pub enum CheckOutput {
7    Artifact(Artifact),
8    Message(Message),
9}
10
11#[derive(Deserialize, Debug)]
12#[allow(dead_code)]
13pub struct Artifact {
14    #[serde(flatten)]
15    pub build_unit: BuildUnit,
16    pub fresh: bool,
17}
18
19#[derive(Deserialize, Debug)]
20pub struct Message {
21    #[serde(flatten)]
22    pub build_unit: BuildUnit,
23    pub message: Diagnostic,
24}
25
26#[derive(Deserialize, Hash, PartialEq, Clone, Eq, Debug)]
27pub struct BuildUnit {
28    pub package_id: String,
29    pub target: Target,
30}
31
32#[derive(Deserialize, Hash, PartialEq, Clone, Eq, Debug)]
33pub struct Target {
34    kind: Vec<Kind>,
35    crate_types: Vec<CrateType>,
36    name: String,
37    src_path: String,
38    edition: String,
39    doc: bool,
40    doctest: bool,
41    test: bool,
42}
43
44#[derive(Deserialize, Hash, PartialEq, Clone, Eq, Debug)]
45#[serde(rename_all(deserialize = "kebab-case"))]
46pub enum Kind {
47    Bin,
48    Example,
49    Test,
50    Bench,
51    CustomBuild,
52    Lib,
53    Rlib,
54    Dylib,
55    Cdylib,
56    Staticlib,
57    ProcMacro,
58    #[serde(untagged)]
59    Other(String),
60}
61
62#[derive(Deserialize, Hash, PartialEq, Clone, Eq, Debug)]
63#[serde(rename_all(deserialize = "kebab-case"))]
64pub enum CrateType {
65    Bin,
66    Lib,
67    Rlib,
68    Dylib,
69    Cdylib,
70    Staticlib,
71    ProcMacro,
72    #[serde(untagged)]
73    Other(String),
74}