pub struct Env;
Expand description
A namespaced wrapper for std::env
functions and constants.
Implementations§
Source§impl Env
§Functions related to environment variables
impl Env
§Functions related to 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() -> Vars ⓘ
Available on crate feature std
only.
pub fn vars() -> Vars ⓘ
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() -> VarsOs ⓘ
Available on crate feature std
only.
pub fn vars_os() -> VarsOs ⓘ
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 feature std
only.
pub unsafe fn remove_var<K: AsRef<OsStr>>(key: K)
std
only.Removes the environment variable key
from the environment
of the currently running process.
§Safety
See remove_var.
Source§impl Env
§Functions related to paths.
impl Env
§Functions related to 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 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) -> SplitPaths<'_> ⓘ
Available on crate feature std
only.
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> ⓘ
std
only.Parses input according to platform conventions for the PATH
environment variable.
See split_paths.
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 } }
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 } }
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 } }
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)
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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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 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_val(&self) -> usize ⓘ
fn mem_align_of_val(&self) -> 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§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.