#cargo #metadata #graph

krates

Create graphs of crates gathered from cargo metadata

5 releases (3 breaking)

0.4.1 Jul 28, 2020
0.4.0 Jul 28, 2020
0.3.1 Jul 18, 2020
0.3.0 Jun 4, 2020
0.1.0 Jan 14, 2020

#11 in Visualization

Download history 350/week @ 2020-04-18 575/week @ 2020-04-25 448/week @ 2020-05-02 425/week @ 2020-05-09 510/week @ 2020-05-16 428/week @ 2020-05-23 602/week @ 2020-05-30 814/week @ 2020-06-06 659/week @ 2020-06-13 867/week @ 2020-06-20 401/week @ 2020-06-27 488/week @ 2020-07-04 440/week @ 2020-07-11 571/week @ 2020-07-18 736/week @ 2020-07-25 520/week @ 2020-08-01

2,369 downloads per month
Used in 2 crates

MIT/Apache

230KB
964 lines

📦 krates

Build Status Crates.io Docs Rust Version Contributor Covenant Embark

Creates graphs of crates from cargo_metadata metadata.

Usage

use krates::{Builder, Cmd, Krates, cm, petgraph};
fn main() -> Result<(), krates::Error> {
    let mut cmd = Cmd::new();
    cmd.manifest_path("path/to/a/Cargo.toml");
    // Enable all features, works for either an entire workspace or a single crate
    cmd.all_features();

    let mut builder = Builder::new();
    // Let's filter out any crates that aren't used by x86_64 windows
    builder.include_targets(std::iter::once(("x86_64-pc-windows-msvc", vec![])));

    let krates: Krates = builder.build(cmd, |pkg: cm::Package| {
        println!("Crate {} was filtered out", pkg.id);
    })?;

    // Print a dot graph of the entire crate graph
    println!("{:?}", petgraph::dot::Dot::new(krates.graph()));

    Ok(())
}

Contributing

We welcome community contributions to this project.

Please read our Contributor Guide for more information on how to get started.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~3MB
~62K SLoC