cargo-pgo 0.3.0

Cargo subcommand for optimizing Rust binaries with PGO and BOLT.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[derive(clap::Parser, Debug)]
pub struct BoltArgs {
    /// Flags that will be passed to the BOLT command.
    /// Using this flag will override BOLT flags normally used by `cargo-pgo`.
    /// If you want to disable all flags, pass an empty string (`--bolt-args ""`).
    #[clap(long, allow_hyphen_values(true))]
    pub(crate) bolt_args: Option<String>,
}

pub fn add_bolt_args(args: &mut Vec<String>, bolt_args: &str) -> anyhow::Result<()> {
    let bolt_args = shellwords::split(bolt_args)
        .map_err(|error| anyhow::anyhow!("Could not parse BOLT args: {:?}", error))?;
    for arg in bolt_args {
        args.push(arg);
    }

    Ok(())
}