pub struct Env;
Expand description
🌐
A namespaced wrapper for std::env
functions and constants.
Implementations§
Source§impl Env
§Constants
impl Env
§Constants
Sourcepub const ARCH: &'static str = { { std::env::consts::ARCH } }
pub const ARCH: &'static str = { { std::env::consts::ARCH } }
?std
A string describing the architecture of the CPU that is currently in use.
Expected values are:
aarch64
, arm
, arm64ec
, avr
, bpf
, csky
, hexagon
, loongarch64
, m68k
, mips
, mips32r6
, mips64
, mips64r6
, msp430
, nvptx64
, powerpc
, powerpc64
, riscv32
, riscv64
, s390x
, sparc
, sparc64
, wasm32
, wasm64
, x86
, x86_64
, and xtensa
.
Sourcepub const FAMILY: &'static str = { { std::env::consts::FAMILY } }
pub const FAMILY: &'static str = { { std::env::consts::FAMILY } }
?std
The family of the operating system.
The expected values are: unix
, wasm
, and windows
Sourcepub const VENDOR: &'static str = { { "unknown" } }
pub const VENDOR: &'static str = { { "unknown" } }
A string describing the vendor of the CPU that is currently in use.
Expected values are:
apple
, espressif
, fortanix
, ibm
, kmc
, nintendo
, nvidia
, pc
, risc0
, sony
, sun
, unikraft
, unknown
, uwp
, win7
, and wrs
.
Sourcepub const OS: &'static str = { { std::env::consts::OS } }
pub const OS: &'static str = { { std::env::consts::OS } }
?std
A string describing the specific operating system in use.
The expected values are:
aix
, android
, cuda
, dragonfly
, emscripten
, espidf
, freebsd
, fuchsia
, haiku
, hermit
, horizon
, hurd
, illumos
, ios
, l4re
, linux
, macos
, netbsd
, none
, nto
, nuttx
, openbsd
, psp
, redox
, rtems
, solaris
, solid_asp3
, teeos
, trusty
, tvos
, uefi
, unknown
, visionos
, vita
, vxworks
, wasi
, watchos
, windows
, xous
, and zkvm
.
Sourcepub const DLL_EXTENSION: &'static str = std::env::consts::DLL_EXTENSION
Available on crate feature std
only.
pub const DLL_EXTENSION: &'static str = std::env::consts::DLL_EXTENSION
std
only.Specifies the file extension used for shared libraries on this platform that goes after the dot.
Some possible values:
so
dylib
dll
Sourcepub const DLL_PREFIX: &'static str = std::env::consts::DLL_PREFIX
Available on crate feature std
only.
pub const DLL_PREFIX: &'static str = std::env::consts::DLL_PREFIX
std
only.Specifies the filename prefix used for shared libraries on this platform.
Some possible values:
lib
- `` (an empty string)
Sourcepub const DLL_SUFFIX: &'static str = std::env::consts::DLL_SUFFIX
Available on crate feature std
only.
pub const DLL_SUFFIX: &'static str = std::env::consts::DLL_SUFFIX
std
only.Specifies the filename suffix used for shared libraries on this platform.
Some possible values:
.so
.dylib
.dll
Sourcepub const EXE_EXTENSION: &'static str = std::env::consts::EXE_EXTENSION
Available on crate feature std
only.
pub const EXE_EXTENSION: &'static str = std::env::consts::EXE_EXTENSION
std
only.Specifies the file extension, if any, used for executable binaries on this platform.
Some possible values:
exe
- `` (an empty string)
Sourcepub const EXE_SUFFIX: &'static str = std::env::consts::EXE_SUFFIX
Available on crate feature std
only.
pub const EXE_SUFFIX: &'static str = std::env::consts::EXE_SUFFIX
std
only.Specifies the filename suffix used for executable binaries on this platform.
Some possible values:
.exe
.nexe
.pexe
- `` (an empty string)
Source§impl Env
§Environment variables
impl Env
§Environment variables
Sourcepub fn var<K: AsRef<OsStr>>(key: K) -> Result<String, VarError> ⓘ
Available on crate feature std
only.
pub fn var<K: AsRef<OsStr>>(key: K) -> Result<String, VarError> ⓘ
std
only.Fetches the environment variable key from the current process.
See var.
Sourcepub fn vars() -> IterVars ⓘ
Available on crate feature std
only.
pub fn vars() -> IterVars ⓘ
std
only.Returns an iterator of (variable, value) pairs of strings, for all the environment variables of the current process.
See vars.
Sourcepub fn var_os<K: AsRef<OsStr>>(key: K) -> Option<OsString> ⓘ
Available on crate feature std
only.
pub fn var_os<K: AsRef<OsStr>>(key: K) -> Option<OsString> ⓘ
std
only.Fetches the environment variable key from the current process.
See var_os.
Sourcepub fn vars_os() -> IterVarsOs ⓘ
Available on crate feature std
only.
pub fn vars_os() -> IterVarsOs ⓘ
std
only.Returns an iterator of (variable, value) pairs of OS strings, for all the environment variables of the current process.
See vars_os.
Sourcepub unsafe fn remove_var<K: AsRef<OsStr>>(key: K)
Available on crate features std
and unsafe_thread
only.
pub unsafe fn remove_var<K: AsRef<OsStr>>(key: K)
std
and unsafe_thread
only.Removes the environment variable key
from the environment
of the currently running process.
§Safety
See remove_var.
Source§impl Env
§Paths
impl Env
§Paths
Sourcepub fn current_exe() -> IoResult<PathBuf>
Available on crate feature std
only.
pub fn current_exe() -> IoResult<PathBuf>
std
only.Returns the full filesystem path of the current running executable.
See current_exe.
Sourcepub fn current_dir() -> IoResult<PathBuf>
Available on crate feature std
only.
pub fn current_dir() -> IoResult<PathBuf>
std
only.Returns the current working directory.
See current_dir.
Sourcepub fn set_current_dir<P: AsRef<Path>>(path: P) -> IoResult<()>
Available on crate feature std
only.
pub fn set_current_dir<P: AsRef<Path>>(path: P) -> IoResult<()>
std
only.Changes the current working directory to the specified path.
See set_current_dir.
Sourcepub fn home_dir() -> Option<PathBuf> ⓘ
Available on crate feature std
only.
pub fn home_dir() -> Option<PathBuf> ⓘ
std
only.Returns the path of the current user’s home directory if known.
See home_dir.
Sourcepub fn temp_dir() -> PathBuf ⓘ
Available on crate feature std
only.
pub fn temp_dir() -> PathBuf ⓘ
std
only.Returns the path of a temporary directory.
See temp_dir.
Sourcepub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> ⓘ
Available on crate feature std
only.
pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> ⓘ
std
only.Joins a collection of Paths appropriately for the PATH
environment variable.
See join_paths.
Sourcepub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> IterSplitPaths<'_> ⓘ
Available on crate feature std
only.
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> IterSplitPaths<'_> ⓘ
std
only.Parses input according to platform conventions for the PATH
environment variable.
See split_paths.
Auto Trait Implementations§
impl Freeze for Env
impl RefUnwindSafe for Env
impl Send for Env
impl Sync for Env
impl Unpin for Env
impl UnwindSafe for Env
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more