-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
88 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
target | ||
|
||
.cargo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,38 @@ | ||
use core; | ||
use core::NameVer; | ||
|
||
#[deriving(Eq,Clone,Show,Encodable,Decodable)] | ||
pub struct Dependency { | ||
name: core::NameVer | ||
name: NameVer | ||
} | ||
|
||
impl Dependency { | ||
pub fn new(name: &str) -> Dependency { | ||
Dependency { name: core::NameVer::new(name.to_owned(), "1.0.0") } | ||
Dependency { name: NameVer::new(name.to_owned(), "1.0.0") } | ||
} | ||
|
||
pub fn with_namever(name: &core::NameVer) -> Dependency { | ||
pub fn with_namever(name: &NameVer) -> Dependency { | ||
Dependency { name: name.clone() } | ||
} | ||
|
||
pub fn with_name_and_version(name: &str, version: &str) -> Dependency { | ||
Dependency { name: core::NameVer::new(name, version) } | ||
Dependency { name: NameVer::new(name, version) } | ||
} | ||
|
||
pub fn get_namever<'a>(&'a self) -> &'a core::NameVer { | ||
pub fn get_namever<'a>(&'a self) -> &'a NameVer { | ||
&self.name | ||
} | ||
|
||
pub fn get_name<'a>(&'a self) -> &'a str { | ||
self.name.get_name() | ||
} | ||
} | ||
|
||
pub trait DependencyNameVers { | ||
fn namevers(&self) -> Vec<NameVer>; | ||
} | ||
|
||
impl DependencyNameVers for Vec<Dependency> { | ||
fn namevers(&self) -> Vec<NameVer> { | ||
self.iter().map(|dep| dep.get_namever().clone()).collect() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters