mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-11 14:30:03 +00:00
Optimize CratesToml
: Use String
as key
to avoid cost of deserializing (`CrateVersionSource::from_str`). Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
9d9a31bef3
commit
96aaca1cc6
1 changed files with 2 additions and 2 deletions
|
@ -13,7 +13,7 @@ use super::CrateVersionSource;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
pub struct CratesToml {
|
pub struct CratesToml {
|
||||||
v1: BTreeMap<CrateVersionSource, BTreeSet<String>>,
|
v1: BTreeMap<String, BTreeSet<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CratesToml {
|
impl CratesToml {
|
||||||
|
@ -31,7 +31,7 @@ impl CratesToml {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert(&mut self, cvs: CrateVersionSource, bins: BTreeSet<String>) {
|
pub fn insert(&mut self, cvs: CrateVersionSource, bins: BTreeSet<String>) {
|
||||||
self.v1.insert(cvs, bins);
|
self.v1.insert(cvs.to_string(), bins);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write(&self) -> Result<(), CratesTomlParseError> {
|
pub fn write(&self) -> Result<(), CratesTomlParseError> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue