mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 13:08: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(),
|
||||
target,
|
||||
bins,
|
||||
other: Default::default(),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
borrow, cmp,
|
||||
collections::{btree_set, BTreeSet},
|
||||
collections::{btree_set, BTreeMap, BTreeSet},
|
||||
hash,
|
||||
io::{self, Seek, Write},
|
||||
iter::{IntoIterator, Iterator},
|
||||
|
@ -24,6 +24,11 @@ pub struct MetaData {
|
|||
pub source: Source,
|
||||
pub target: 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 {
|
||||
|
@ -253,6 +258,7 @@ mod test {
|
|||
source: Source::cratesio_registry(),
|
||||
target: target.clone(),
|
||||
bins: vec!["1".into(), "2".into()],
|
||||
other: Default::default(),
|
||||
},
|
||||
MetaData {
|
||||
name: "b".into(),
|
||||
|
@ -261,6 +267,7 @@ mod test {
|
|||
source: Source::cratesio_registry(),
|
||||
target: target.clone(),
|
||||
bins: vec!["1".into(), "2".into()],
|
||||
other: Default::default(),
|
||||
},
|
||||
MetaData {
|
||||
name: "a".into(),
|
||||
|
@ -269,6 +276,7 @@ mod test {
|
|||
source: Source::cratesio_registry(),
|
||||
target: target.clone(),
|
||||
bins: vec!["1".into()],
|
||||
other: Default::default(),
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -299,6 +307,7 @@ mod test {
|
|||
source: Source::cratesio_registry(),
|
||||
target,
|
||||
bins: vec!["1".into(), "2".into()],
|
||||
other: Default::default(),
|
||||
};
|
||||
append_to_path(&path, [new_metadata.clone()]).unwrap();
|
||||
metadata_set.insert(new_metadata);
|
||||
|
|
Loading…
Add table
Reference in a new issue