use guppy::graph::{DependencyDirection, PackageGraph};
use guppy::{Error, PackageId};
use std::iter;
fn main() -> Result<(), Error> {
let fixture = include_str!("../fixtures/small/metadata1.json");
let package_graph = PackageGraph::from_json(fixture)?;
let package_id = PackageId::new("testcrate 0.1.0 (path+file:///fakepath/testcrate)");
for link in package_graph.dep_links(&package_id).unwrap() {
println!("direct: {}", link.to.id());
}
let query = package_graph.query_forward(iter::once(&package_id))?;
let package_set = query.resolve();
for dep_id in package_set.into_ids(DependencyDirection::Forward) {
println!("transitive: {}", dep_id);
}
Ok(())
}