Use CompactString for Options::version_req

which is unlikely to be larger than 24 bytes.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-08-02 22:26:24 +10:00
parent a2e6709ed6
commit a52ac3fc7a
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 5 additions and 2 deletions

View file

@ -1,5 +1,7 @@
use std::path::PathBuf; use std::path::PathBuf;
use compact_str::CompactString;
use crate::{metafiles::binstall_v1::MetaData, DesiredTargets, PkgOverride}; use crate::{metafiles::binstall_v1::MetaData, DesiredTargets, PkgOverride};
mod resolve; mod resolve;
@ -11,7 +13,7 @@ pub use install::*;
pub struct Options { pub struct Options {
pub no_symlinks: bool, pub no_symlinks: bool,
pub dry_run: bool, pub dry_run: bool,
pub version: Option<String>, pub version: Option<CompactString>,
pub manifest_path: Option<PathBuf>, pub manifest_path: Option<PathBuf>,
pub cli_overrides: PkgOverride, pub cli_overrides: PkgOverride,
pub desired_targets: DesiredTargets, pub desired_targets: DesiredTargets,

View file

@ -8,6 +8,7 @@ use std::{
}; };
use clap::{AppSettings, Parser}; use clap::{AppSettings, Parser};
use compact_str::CompactString;
use log::{debug, error, info, warn, LevelFilter}; use log::{debug, error, info, warn, LevelFilter};
use miette::{miette, Result, WrapErr}; use miette::{miette, Result, WrapErr};
use simplelog::{ColorChoice, ConfigBuilder, TermLogger, TerminalMode}; use simplelog::{ColorChoice, ConfigBuilder, TermLogger, TerminalMode};
@ -42,7 +43,7 @@ struct Options {
/// Cannot be used when multiple packages are installed at once, use the attached version /// Cannot be used when multiple packages are installed at once, use the attached version
/// syntax in that case. /// syntax in that case.
#[clap(help_heading = "Package selection", long = "version")] #[clap(help_heading = "Package selection", long = "version")]
version_req: Option<String>, version_req: Option<CompactString>,
/// Override binary target set. /// Override binary target set.
/// ///