mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-02 10:10:02 +00:00
Split crates and clean up structure of codebase (#294)
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
bf700f9012
commit
4b00f5f143
88 changed files with 2989 additions and 1423 deletions
23
crates/lib/src/helpers/statics.rs
Normal file
23
crates/lib/src/helpers/statics.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
use std::{
|
||||
io::Error,
|
||||
ops::Deref,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use once_cell::sync::{Lazy, OnceCell};
|
||||
use url::Url;
|
||||
|
||||
pub fn cargo_home() -> Result<&'static Path, Error> {
|
||||
static CARGO_HOME: OnceCell<PathBuf> = OnceCell::new();
|
||||
|
||||
CARGO_HOME
|
||||
.get_or_try_init(home::cargo_home)
|
||||
.map(Deref::deref)
|
||||
}
|
||||
|
||||
pub fn cratesio_url() -> &'static Url {
|
||||
static CRATESIO: Lazy<Url, fn() -> Url> =
|
||||
Lazy::new(|| Url::parse("https://github.com/rust-lang/crates.io-index").unwrap());
|
||||
|
||||
&*CRATESIO
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue