mod.rs
use camino::Utf8PathBuf;
use cargo_metadata::Edition;
use serde::{Deserialize, Serialize};
pub mod self_profile;
pub mod timings;
pub mod unit_graph;
/// See https://docs.rs/cargo/latest/cargo/core/compiler/enum.CompileMode.html
/// These are the only two cases we are interested in
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum Mode {
Build,
RunCustomBuild,
}
/// See https://doc.rust-lang.org/nightly/nightly-rustc/cargo/core/manifest/enum.TargetKind.html
/// and https://doc.rust-lang.org/nightly/nightly-rustc/cargo/core/manifest/enum.TargetKind.html#impl-Serialize-for-TargetKind
/// This is different to the original enum as `CrateType` has been manually flattened into this enum,
/// so some information is lost in favour of simplicity
// TODO: fix this limitation, make `TargetKind` match cargo's definition
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum TargetKind {
Lib,
Bin,
Test,
Bench,
ExampleLib,
ExampleBin,
CustomBuild,
Rlib,
Dylib,
Cdylib,
Staticlib,
ProcMacro,
}
/// See https://doc.rust-lang.org/nightly/nightly-rustc/cargo/core/manifest/struct.TargetInner.html
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Target {
pub kind: Vec<TargetKind>,
pub name: String,
pub src_path: Utf8PathBuf,
pub edition: Edition,
pub doc: bool,
pub doctest: bool,
pub test: bool,
}