mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 13:38:43 +00:00
Use CompactString
for field CrateVersionSource::name
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
cb4cffd0ab
commit
241b763477
1 changed files with 4 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
use std::{borrow::Cow, fmt, str::FromStr};
|
||||
|
||||
use compact_str::CompactString;
|
||||
use miette::Diagnostic;
|
||||
use semver::Version;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
@ -10,7 +11,7 @@ use crate::cratesio_url;
|
|||
|
||||
#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq)]
|
||||
pub struct CrateVersionSource {
|
||||
pub name: String,
|
||||
pub name: CompactString,
|
||||
pub version: Version,
|
||||
pub source: Source,
|
||||
}
|
||||
|
@ -18,7 +19,7 @@ pub struct CrateVersionSource {
|
|||
impl From<&super::binstall_v1::MetaData> for CrateVersionSource {
|
||||
fn from(metadata: &super::binstall_v1::MetaData) -> Self {
|
||||
super::CrateVersionSource {
|
||||
name: metadata.name.clone().to_string(),
|
||||
name: metadata.name.clone(),
|
||||
version: metadata.current_version.clone(),
|
||||
source: Source::from(&metadata.source),
|
||||
}
|
||||
|
@ -75,7 +76,7 @@ impl FromStr for CrateVersionSource {
|
|||
_ => return Err(CvsParseError::BadSource),
|
||||
};
|
||||
Ok(Self {
|
||||
name: name.to_string(),
|
||||
name: name.into(),
|
||||
version,
|
||||
source,
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue