pub use alloc::{
boxed::Box,
format,
string::{String, ToString},
vec,
vec::Vec,
};
#[cfg(feature = "std")]
#[allow(unused_imports)]
mod std {
pub use hashbrown::{DefaultHashBuilder, HashMap, HashSet};
pub use std::env::{self, consts, current_dir, var, var_os};
pub use std::ffi::{OsStr, OsString};
pub use std::fs::{canonicalize, copy, create_dir_all, read, read_dir, read_to_string, remove_dir_all, remove_file, write, File, OpenOptions};
#[cfg(unix)]
pub use std::fs::{set_permissions, Permissions};
pub use std::io::{self, BufRead, BufReader, Cursor, Error, ErrorKind, Read, Write};
#[cfg(any(unix, target_os = "wasi", target_os = "redox"))]
pub use std::os::unix::fs::{OpenOptionsExt, PermissionsExt};
pub use std::path::{absolute, Path, PathBuf};
pub use std::process::{exit, Command, ExitStatus, Output, Stdio};
pub use std::sync::{Mutex, OnceLock};
pub use triomphe::Arc;
}
#[allow(unused_imports)]
mod no_std {
pub use hashbrown::{DefaultHashBuilder, HashMap, HashSet};
pub use triomphe::Arc;
}
#[cfg(not(feature = "std"))]
pub use no_std::*;
#[cfg(feature = "std")]
pub use std::*;
#[cfg(feature = "std")]
pub trait CommandOutput {
fn stdout(&self) -> String;
fn stderr(&self) -> String;
}
#[cfg(feature = "std")]
impl CommandOutput for Output {
fn stdout(&self) -> String {
match String::from_utf8(self.stdout.clone()) {
| Ok(value) => value.trim().to_string(),
| Err(why) => format!("<non-utf8-bytes:{:?}>", why.into_bytes()),
}
}
fn stderr(&self) -> String {
match String::from_utf8(self.stderr.clone()) {
| Ok(value) => value.trim().to_string(),
| Err(why) => format!("<non-utf8-bytes:{:?}>", why.into_bytes()),
}
}
}
#[cfg(feature = "std")]
pub fn vale_release_filename() -> String {
let os = std::consts::OS.to_lowercase();
let platform = match os.as_str() {
| "linux" => "Linux_64-bit.tar.gz",
| "macos" | "apple" => "macOS_64-bit.tar.gz",
| "windows" => "Windows_64-bit.zip",
| _ => "unknown",
};
platform.to_string()
}