mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 05:28:42 +00:00
Add field MetaData::other
for forward compatibility
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
00fb2528af
commit
98556cb2af
2 changed files with 11 additions and 1 deletions
|
@ -36,6 +36,7 @@ pub async fn install(
|
||||||
source: Source::cratesio_registry(),
|
source: Source::cratesio_registry(),
|
||||||
target,
|
target,
|
||||||
bins,
|
bins,
|
||||||
|
other: Default::default(),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
borrow, cmp,
|
borrow, cmp,
|
||||||
collections::{btree_set, BTreeSet},
|
collections::{btree_set, BTreeMap, BTreeSet},
|
||||||
hash,
|
hash,
|
||||||
io::{self, Seek, Write},
|
io::{self, Seek, Write},
|
||||||
iter::{IntoIterator, Iterator},
|
iter::{IntoIterator, Iterator},
|
||||||
|
@ -24,6 +24,11 @@ pub struct MetaData {
|
||||||
pub source: Source,
|
pub source: Source,
|
||||||
pub target: CompactString,
|
pub target: CompactString,
|
||||||
pub bins: Vec<CompactString>,
|
pub bins: Vec<CompactString>,
|
||||||
|
|
||||||
|
/// Forwards compatibility. Unknown keys from future versions of Cargo
|
||||||
|
/// will be stored here and retained when the file is saved.
|
||||||
|
#[serde(flatten)]
|
||||||
|
pub other: BTreeMap<CompactString, serde_json::Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl borrow::Borrow<str> for MetaData {
|
impl borrow::Borrow<str> for MetaData {
|
||||||
|
@ -253,6 +258,7 @@ mod test {
|
||||||
source: Source::cratesio_registry(),
|
source: Source::cratesio_registry(),
|
||||||
target: target.clone(),
|
target: target.clone(),
|
||||||
bins: vec!["1".into(), "2".into()],
|
bins: vec!["1".into(), "2".into()],
|
||||||
|
other: Default::default(),
|
||||||
},
|
},
|
||||||
MetaData {
|
MetaData {
|
||||||
name: "b".into(),
|
name: "b".into(),
|
||||||
|
@ -261,6 +267,7 @@ mod test {
|
||||||
source: Source::cratesio_registry(),
|
source: Source::cratesio_registry(),
|
||||||
target: target.clone(),
|
target: target.clone(),
|
||||||
bins: vec!["1".into(), "2".into()],
|
bins: vec!["1".into(), "2".into()],
|
||||||
|
other: Default::default(),
|
||||||
},
|
},
|
||||||
MetaData {
|
MetaData {
|
||||||
name: "a".into(),
|
name: "a".into(),
|
||||||
|
@ -269,6 +276,7 @@ mod test {
|
||||||
source: Source::cratesio_registry(),
|
source: Source::cratesio_registry(),
|
||||||
target: target.clone(),
|
target: target.clone(),
|
||||||
bins: vec!["1".into()],
|
bins: vec!["1".into()],
|
||||||
|
other: Default::default(),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -299,6 +307,7 @@ mod test {
|
||||||
source: Source::cratesio_registry(),
|
source: Source::cratesio_registry(),
|
||||||
target,
|
target,
|
||||||
bins: vec!["1".into(), "2".into()],
|
bins: vec!["1".into(), "2".into()],
|
||||||
|
other: Default::default(),
|
||||||
};
|
};
|
||||||
append_to_path(&path, [new_metadata.clone()]).unwrap();
|
append_to_path(&path, [new_metadata.clone()]).unwrap();
|
||||||
metadata_set.insert(new_metadata);
|
metadata_set.insert(new_metadata);
|
||||||
|
|
Loading…
Add table
Reference in a new issue