mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 13:08:42 +00:00
Add new enum TLSVersion
which impl ArgEnum
and can be converted to `reqwest::tls::Version` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
8e92db3dc6
commit
eb7d460a9a
2 changed files with 20 additions and 0 deletions
|
@ -27,6 +27,9 @@ mod stream_readable;
|
||||||
mod path_ext;
|
mod path_ext;
|
||||||
pub use path_ext::*;
|
pub use path_ext::*;
|
||||||
|
|
||||||
|
mod tls_version;
|
||||||
|
pub use tls_version::TLSVersion;
|
||||||
|
|
||||||
/// Load binstall metadata from the crate `Cargo.toml` at the provided path
|
/// Load binstall metadata from the crate `Cargo.toml` at the provided path
|
||||||
pub fn load_manifest_path<P: AsRef<Path>>(
|
pub fn load_manifest_path<P: AsRef<Path>>(
|
||||||
manifest_path: P,
|
manifest_path: P,
|
||||||
|
|
17
src/helpers/tls_version.rs
Normal file
17
src/helpers/tls_version.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
use clap::ArgEnum;
|
||||||
|
use reqwest::tls::Version;
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, ArgEnum)]
|
||||||
|
pub enum TLSVersion {
|
||||||
|
Tls1_2,
|
||||||
|
Tls1_3,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<TLSVersion> for Version {
|
||||||
|
fn from(ver: TLSVersion) -> Self {
|
||||||
|
match ver {
|
||||||
|
TLSVersion::Tls1_2 => Version::TLS_1_2,
|
||||||
|
TLSVersion::Tls1_3 => Version::TLS_1_3,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue