mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 21:48:42 +00:00
Impl Borrow<str>
for MetaData
for Records
so that we can use `&str` to query `BTreeSet<MetaData>` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
aba2c87d6d
commit
04f167491a
1 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
use std::{
|
use std::{
|
||||||
cmp,
|
borrow, cmp,
|
||||||
collections::{btree_set, BTreeSet},
|
collections::{btree_set, BTreeSet},
|
||||||
fs, hash,
|
fs, hash,
|
||||||
io::{self, Write},
|
io::{self, Write},
|
||||||
|
@ -25,6 +25,13 @@ pub struct MetaData {
|
||||||
pub target: CompactString,
|
pub target: CompactString,
|
||||||
pub bins: Vec<CompactString>,
|
pub bins: Vec<CompactString>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl borrow::Borrow<str> for MetaData {
|
||||||
|
fn borrow(&self) -> &str {
|
||||||
|
&self.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PartialEq for MetaData {
|
impl PartialEq for MetaData {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.name == other.name
|
self.name == other.name
|
||||||
|
|
Loading…
Add table
Reference in a new issue