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"
|
hyper-tls = "0.1.2"
|
||||||
lazy_static = "1.0.0"
|
lazy_static = "1.0.0"
|
||||||
maud = "0.17.2"
|
maud = "0.17.2"
|
||||||
|
ordermap = "0.4.0"
|
||||||
route-recognizer = "0.1.12"
|
route-recognizer = "0.1.12"
|
||||||
semver = { version = "0.9.0", features = ["serde"] }
|
semver = { version = "0.9.0", features = ["serde"] }
|
||||||
serde = "1.0.27"
|
serde = "1.0.27"
|
||||||
|
|
|
@ -2,12 +2,13 @@ use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
|
use ordermap::map::OrderMap;
|
||||||
|
|
||||||
use ::parsers::manifest::parse_manifest_toml;
|
use ::parsers::manifest::parse_manifest_toml;
|
||||||
use ::models::crates::{CrateDeps, CrateName, CrateManifest};
|
use ::models::crates::{CrateDeps, CrateName, CrateManifest};
|
||||||
|
|
||||||
pub struct ManifestCrawlerOutput {
|
pub struct ManifestCrawlerOutput {
|
||||||
pub crates: Vec<(CrateName, CrateDeps)>
|
pub crates: OrderMap<CrateName, CrateDeps>
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ManifestCrawlerStepOutput {
|
pub struct ManifestCrawlerStepOutput {
|
||||||
|
@ -16,14 +17,14 @@ pub struct ManifestCrawlerStepOutput {
|
||||||
|
|
||||||
pub struct ManifestCrawler {
|
pub struct ManifestCrawler {
|
||||||
manifests: HashMap<PathBuf, CrateManifest>,
|
manifests: HashMap<PathBuf, CrateManifest>,
|
||||||
leaf_crates: Vec<(CrateName, CrateDeps)>
|
leaf_crates: OrderMap<CrateName, CrateDeps>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ManifestCrawler {
|
impl ManifestCrawler {
|
||||||
pub fn new() -> ManifestCrawler {
|
pub fn new() -> ManifestCrawler {
|
||||||
ManifestCrawler {
|
ManifestCrawler {
|
||||||
manifests: HashMap::new(),
|
manifests: HashMap::new(),
|
||||||
leaf_crates: vec![]
|
leaf_crates: OrderMap::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ impl ManifestCrawler {
|
||||||
|
|
||||||
match manifest {
|
match manifest {
|
||||||
CrateManifest::Package(name, deps) => {
|
CrateManifest::Package(name, deps) => {
|
||||||
self.leaf_crates.push((name, deps));
|
self.leaf_crates.insert(name, deps);
|
||||||
},
|
},
|
||||||
CrateManifest::Workspace { members } => {
|
CrateManifest::Workspace { members } => {
|
||||||
for mut member in members {
|
for mut member in members {
|
||||||
|
@ -45,7 +46,7 @@ impl ManifestCrawler {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CrateManifest::Mixed { name, deps, members } => {
|
CrateManifest::Mixed { name, deps, members } => {
|
||||||
self.leaf_crates.push((name, deps));
|
self.leaf_crates.insert(name, deps);
|
||||||
for mut member in members {
|
for mut member in members {
|
||||||
output.paths_of_interest.push(path.clone().join(member));
|
output.paths_of_interest.push(path.clone().join(member));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ extern crate hyper;
|
||||||
extern crate hyper_tls;
|
extern crate hyper_tls;
|
||||||
#[macro_use] extern crate lazy_static;
|
#[macro_use] extern crate lazy_static;
|
||||||
extern crate maud;
|
extern crate maud;
|
||||||
|
extern crate ordermap;
|
||||||
extern crate route_recognizer;
|
extern crate route_recognizer;
|
||||||
extern crate semver;
|
extern crate semver;
|
||||||
#[macro_use] extern crate serde_derive;
|
#[macro_use] extern crate serde_derive;
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::str::FromStr;
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
use semver::{Version, VersionReq};
|
use semver::{Version, VersionReq};
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct CrateName(String);
|
pub struct CrateName(String);
|
||||||
|
|
||||||
impl Into<String> for CrateName {
|
impl Into<String> for CrateName {
|
||||||
|
|
Loading…
Reference in a new issue