mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-22 02:16:30 +00:00
use OrderMap for crates list
This commit is contained in:
parent
9421c09a2c
commit
19f97f917e
4 changed files with 9 additions and 6 deletions
|
@ -11,6 +11,7 @@ hyper = "0.11.15"
|
|||
hyper-tls = "0.1.2"
|
||||
lazy_static = "1.0.0"
|
||||
maud = "0.17.2"
|
||||
ordermap = "0.4.0"
|
||||
route-recognizer = "0.1.12"
|
||||
semver = { version = "0.9.0", features = ["serde"] }
|
||||
serde = "1.0.27"
|
||||
|
|
|
@ -2,12 +2,13 @@ use std::collections::HashMap;
|
|||
use std::path::PathBuf;
|
||||
|
||||
use failure::Error;
|
||||
use ordermap::map::OrderMap;
|
||||
|
||||
use ::parsers::manifest::parse_manifest_toml;
|
||||
use ::models::crates::{CrateDeps, CrateName, CrateManifest};
|
||||
|
||||
pub struct ManifestCrawlerOutput {
|
||||
pub crates: Vec<(CrateName, CrateDeps)>
|
||||
pub crates: OrderMap<CrateName, CrateDeps>
|
||||
}
|
||||
|
||||
pub struct ManifestCrawlerStepOutput {
|
||||
|
@ -16,14 +17,14 @@ pub struct ManifestCrawlerStepOutput {
|
|||
|
||||
pub struct ManifestCrawler {
|
||||
manifests: HashMap<PathBuf, CrateManifest>,
|
||||
leaf_crates: Vec<(CrateName, CrateDeps)>
|
||||
leaf_crates: OrderMap<CrateName, CrateDeps>
|
||||
}
|
||||
|
||||
impl ManifestCrawler {
|
||||
pub fn new() -> ManifestCrawler {
|
||||
ManifestCrawler {
|
||||
manifests: HashMap::new(),
|
||||
leaf_crates: vec![]
|
||||
leaf_crates: OrderMap::new()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +38,7 @@ impl ManifestCrawler {
|
|||
|
||||
match manifest {
|
||||
CrateManifest::Package(name, deps) => {
|
||||
self.leaf_crates.push((name, deps));
|
||||
self.leaf_crates.insert(name, deps);
|
||||
},
|
||||
CrateManifest::Workspace { members } => {
|
||||
for mut member in members {
|
||||
|
@ -45,7 +46,7 @@ impl ManifestCrawler {
|
|||
}
|
||||
},
|
||||
CrateManifest::Mixed { name, deps, members } => {
|
||||
self.leaf_crates.push((name, deps));
|
||||
self.leaf_crates.insert(name, deps);
|
||||
for mut member in members {
|
||||
output.paths_of_interest.push(path.clone().join(member));
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ extern crate hyper;
|
|||
extern crate hyper_tls;
|
||||
#[macro_use] extern crate lazy_static;
|
||||
extern crate maud;
|
||||
extern crate ordermap;
|
||||
extern crate route_recognizer;
|
||||
extern crate semver;
|
||||
#[macro_use] extern crate serde_derive;
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::str::FromStr;
|
|||
use failure::Error;
|
||||
use semver::{Version, VersionReq};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct CrateName(String);
|
||||
|
||||
impl Into<String> for CrateName {
|
||||
|
|
Loading…
Reference in a new issue