1 //! Inspection and manipulation of the process's environment.
3 //! This module contains functions to inspect various aspects such as
4 //! environment variables, process arguments, the current directory, and various
5 //! other important directories.
7 //! There are several functions and structs in this module that have a
8 //! counterpart ending in `os`. Those ending in `os` will return an [`OsString`]
9 //! and those without will return a [`String`].
11 #![stable(feature = "env", since = "1.0.0")]
16 use crate::error
::Error
;
17 use crate::ffi
::{OsStr, OsString}
;
20 use crate::path
::{Path, PathBuf}
;
22 use crate::sys
::os
as os_imp
;
24 /// Returns the current working directory as a [`PathBuf`].
28 /// Returns an [`Err`] if the current working directory value is invalid.
31 /// * Current directory does not exist.
32 /// * There are insufficient permissions to access the current directory.
39 /// fn main() -> std::io::Result<()> {
40 /// let path = env::current_dir()?;
41 /// println!("The current directory is {}", path.display());
45 #[stable(feature = "env", since = "1.0.0")]
46 pub fn current_dir() -> io
::Result
<PathBuf
> {
50 /// Changes the current working directory to the specified path.
52 /// Returns an [`Err`] if the operation fails.
58 /// use std::path::Path;
60 /// let root = Path::new("/");
61 /// assert!(env::set_current_dir(&root).is_ok());
62 /// println!("Successfully changed working directory to {}!", root.display());
64 #[stable(feature = "env", since = "1.0.0")]
65 pub fn set_current_dir
<P
: AsRef
<Path
>>(path
: P
) -> io
::Result
<()> {
66 os_imp
::chdir(path
.as_ref())
69 /// An iterator over a snapshot of the environment variables of this process.
71 /// This structure is created by [`env::vars()`]. See its documentation for more.
73 /// [`env::vars()`]: vars
74 #[stable(feature = "env", since = "1.0.0")]
79 /// An iterator over a snapshot of the environment variables of this process.
81 /// This structure is created by [`env::vars_os()`]. See its documentation for more.
83 /// [`env::vars_os()`]: vars_os
84 #[stable(feature = "env", since = "1.0.0")]
89 /// Returns an iterator of (variable, value) pairs of strings, for all the
90 /// environment variables of the current process.
92 /// The returned iterator contains a snapshot of the process's environment
93 /// variables at the time of this invocation. Modifications to environment
94 /// variables afterwards will not be reflected in the returned iterator.
98 /// While iterating, the returned iterator will panic if any key or value in the
99 /// environment is not valid unicode. If this is not desired, consider using
100 /// [`env::vars_os()`].
107 /// // We will iterate through the references to the element returned by
109 /// for (key, value) in env::vars() {
110 /// println!("{}: {}", key, value);
114 /// [`env::vars_os()`]: vars_os
115 #[stable(feature = "env", since = "1.0.0")]
116 pub fn vars() -> Vars
{
117 Vars { inner: vars_os() }
120 /// Returns an iterator of (variable, value) pairs of OS strings, for all the
121 /// environment variables of the current process.
123 /// The returned iterator contains a snapshot of the process's environment
124 /// variables at the time of this invocation. Modifications to environment
125 /// variables afterwards will not be reflected in the returned iterator.
132 /// // We will iterate through the references to the element returned by
133 /// // env::vars_os();
134 /// for (key, value) in env::vars_os() {
135 /// println!("{:?}: {:?}", key, value);
138 #[stable(feature = "env", since = "1.0.0")]
139 pub fn vars_os() -> VarsOs
{
140 VarsOs { inner: os_imp::env() }
143 #[stable(feature = "env", since = "1.0.0")]
144 impl Iterator
for Vars
{
145 type Item
= (String
, String
);
146 fn next(&mut self) -> Option
<(String
, String
)> {
147 self.inner
.next().map(|(a
, b
)| (a
.into_string().unwrap(), b
.into_string().unwrap()))
149 fn size_hint(&self) -> (usize, Option
<usize>) {
150 self.inner
.size_hint()
154 #[stable(feature = "std_debug", since = "1.16.0")]
155 impl fmt
::Debug
for Vars
{
156 fn fmt(&self, f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
161 #[stable(feature = "env", since = "1.0.0")]
162 impl Iterator
for VarsOs
{
163 type Item
= (OsString
, OsString
);
164 fn next(&mut self) -> Option
<(OsString
, OsString
)> {
167 fn size_hint(&self) -> (usize, Option
<usize>) {
168 self.inner
.size_hint()
172 #[stable(feature = "std_debug", since = "1.16.0")]
173 impl fmt
::Debug
for VarsOs
{
174 fn fmt(&self, f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
175 f
.pad("VarsOs { .. }")
179 /// Fetches the environment variable `key` from the current process.
183 /// * Environment variable is not present
184 /// * Environment variable is not valid unicode
188 /// This function may panic if `key` is empty, contains an ASCII equals sign
189 /// `'='` or the NUL character `'\0'`, or when the value contains the NUL
197 /// let key = "HOME";
198 /// match env::var(key) {
199 /// Ok(val) => println!("{}: {:?}", key, val),
200 /// Err(e) => println!("couldn't interpret {}: {}", key, e),
203 #[stable(feature = "env", since = "1.0.0")]
204 pub fn var
<K
: AsRef
<OsStr
>>(key
: K
) -> Result
<String
, VarError
> {
208 fn _var(key
: &OsStr
) -> Result
<String
, VarError
> {
210 Some(s
) => s
.into_string().map_err(VarError
::NotUnicode
),
211 None
=> Err(VarError
::NotPresent
),
215 /// Fetches the environment variable `key` from the current process, returning
216 /// [`None`] if the variable isn't set.
220 /// This function may panic if `key` is empty, contains an ASCII equals sign
221 /// `'='` or the NUL character `'\0'`, or when the value contains the NUL
229 /// let key = "HOME";
230 /// match env::var_os(key) {
231 /// Some(val) => println!("{}: {:?}", key, val),
232 /// None => println!("{} is not defined in the environment.", key)
235 #[stable(feature = "env", since = "1.0.0")]
236 pub fn var_os
<K
: AsRef
<OsStr
>>(key
: K
) -> Option
<OsString
> {
237 _var_os(key
.as_ref())
240 fn _var_os(key
: &OsStr
) -> Option
<OsString
> {
242 .unwrap_or_else(|e
| panic
!("failed to get environment variable `{:?}`: {}", key
, e
))
245 /// The error type for operations interacting with environment variables.
246 /// Possibly returned from [`env::var()`].
248 /// [`env::var()`]: var
249 #[derive(Debug, PartialEq, Eq, Clone)]
250 #[stable(feature = "env", since = "1.0.0")]
252 /// The specified environment variable was not present in the current
253 /// process's environment.
254 #[stable(feature = "env", since = "1.0.0")]
257 /// The specified environment variable was found, but it did not contain
258 /// valid unicode data. The found data is returned as a payload of this
260 #[stable(feature = "env", since = "1.0.0")]
261 NotUnicode(#[stable(feature = "env", since = "1.0.0")] OsString),
264 #[stable(feature = "env", since = "1.0.0")]
265 impl fmt
::Display
for VarError
{
266 fn fmt(&self, f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
268 VarError
::NotPresent
=> write
!(f
, "environment variable not found"),
269 VarError
::NotUnicode(ref s
) => {
270 write
!(f
, "environment variable was not valid unicode: {:?}", s
)
276 #[stable(feature = "env", since = "1.0.0")]
277 impl Error
for VarError
{
279 fn description(&self) -> &str {
281 VarError
::NotPresent
=> "environment variable not found",
282 VarError
::NotUnicode(..) => "environment variable was not valid unicode",
287 /// Sets the environment variable `k` to the value `v` for the currently running
290 /// Note that while concurrent access to environment variables is safe in Rust,
291 /// some platforms only expose inherently unsafe non-threadsafe APIs for
292 /// inspecting the environment. As a result, extra care needs to be taken when
293 /// auditing calls to unsafe external FFI functions to ensure that any external
294 /// environment accesses are properly synchronized with accesses in Rust.
296 /// Discussion of this unsafety on Unix may be found in:
298 /// - [Austin Group Bugzilla](http://austingroupbugs.net/view.php?id=188)
299 /// - [GNU C library Bugzilla](https://sourceware.org/bugzilla/show_bug.cgi?id=15607#c2)
303 /// This function may panic if `key` is empty, contains an ASCII equals sign
304 /// `'='` or the NUL character `'\0'`, or when the value contains the NUL
313 /// env::set_var(key, "VALUE");
314 /// assert_eq!(env::var(key), Ok("VALUE".to_string()));
316 #[stable(feature = "env", since = "1.0.0")]
317 pub fn set_var
<K
: AsRef
<OsStr
>, V
: AsRef
<OsStr
>>(k
: K
, v
: V
) {
318 _set_var(k
.as_ref(), v
.as_ref())
321 fn _set_var(k
: &OsStr
, v
: &OsStr
) {
322 os_imp
::setenv(k
, v
).unwrap_or_else(|e
| {
323 panic
!("failed to set environment variable `{:?}` to `{:?}`: {}", k
, v
, e
)
327 /// Removes an environment variable from the environment of the currently running process.
329 /// Note that while concurrent access to environment variables is safe in Rust,
330 /// some platforms only expose inherently unsafe non-threadsafe APIs for
331 /// inspecting the environment. As a result extra care needs to be taken when
332 /// auditing calls to unsafe external FFI functions to ensure that any external
333 /// environment accesses are properly synchronized with accesses in Rust.
335 /// Discussion of this unsafety on Unix may be found in:
337 /// - [Austin Group Bugzilla](http://austingroupbugs.net/view.php?id=188)
338 /// - [GNU C library Bugzilla](https://sourceware.org/bugzilla/show_bug.cgi?id=15607#c2)
342 /// This function may panic if `key` is empty, contains an ASCII equals sign
343 /// `'='` or the NUL character `'\0'`, or when the value contains the NUL
352 /// env::set_var(key, "VALUE");
353 /// assert_eq!(env::var(key), Ok("VALUE".to_string()));
355 /// env::remove_var(key);
356 /// assert!(env::var(key).is_err());
358 #[stable(feature = "env", since = "1.0.0")]
359 pub fn remove_var
<K
: AsRef
<OsStr
>>(k
: K
) {
360 _remove_var(k
.as_ref())
363 fn _remove_var(k
: &OsStr
) {
365 .unwrap_or_else(|e
| panic
!("failed to remove environment variable `{:?}`: {}", k
, e
))
368 /// An iterator that splits an environment variable into paths according to
369 /// platform-specific conventions.
371 /// The iterator element type is [`PathBuf`].
373 /// This structure is created by [`env::split_paths()`]. See its
374 /// documentation for more.
376 /// [`env::split_paths()`]: split_paths
377 #[stable(feature = "env", since = "1.0.0")]
378 pub struct SplitPaths
<'a
> {
379 inner
: os_imp
::SplitPaths
<'a
>,
382 /// Parses input according to platform conventions for the `PATH`
383 /// environment variable.
385 /// Returns an iterator over the paths contained in `unparsed`. The iterator
386 /// element type is [`PathBuf`].
393 /// let key = "PATH";
394 /// match env::var_os(key) {
396 /// for path in env::split_paths(&paths) {
397 /// println!("'{}'", path.display());
400 /// None => println!("{} is not defined in the environment.", key)
403 #[stable(feature = "env", since = "1.0.0")]
404 pub fn split_paths
<T
: AsRef
<OsStr
> + ?Sized
>(unparsed
: &T
) -> SplitPaths
<'_
> {
405 SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) }
408 #[stable(feature = "env", since = "1.0.0")]
409 impl<'a
> Iterator
for SplitPaths
<'a
> {
411 fn next(&mut self) -> Option
<PathBuf
> {
414 fn size_hint(&self) -> (usize, Option
<usize>) {
415 self.inner
.size_hint()
419 #[stable(feature = "std_debug", since = "1.16.0")]
420 impl fmt
::Debug
for SplitPaths
<'_
> {
421 fn fmt(&self, f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
422 f
.pad("SplitPaths { .. }")
426 /// The error type for operations on the `PATH` variable. Possibly returned from
427 /// [`env::join_paths()`].
429 /// [`env::join_paths()`]: join_paths
431 #[stable(feature = "env", since = "1.0.0")]
432 pub struct JoinPathsError
{
433 inner
: os_imp
::JoinPathsError
,
436 /// Joins a collection of [`Path`]s appropriately for the `PATH`
437 /// environment variable.
441 /// Returns an [`Err`] (containing an error message) if one of the input
442 /// [`Path`]s contains an invalid character for constructing the `PATH`
443 /// variable (a double quote on Windows or a colon on Unix).
447 /// Joining paths on a Unix-like platform:
451 /// use std::ffi::OsString;
452 /// use std::path::Path;
454 /// fn main() -> Result<(), env::JoinPathsError> {
455 /// # if cfg!(unix) {
456 /// let paths = [Path::new("/bin"), Path::new("/usr/bin")];
457 /// let path_os_string = env::join_paths(paths.iter())?;
458 /// assert_eq!(path_os_string, OsString::from("/bin:/usr/bin"));
464 /// Joining a path containing a colon on a Unix-like platform results in an
468 /// # if cfg!(unix) {
470 /// use std::path::Path;
472 /// let paths = [Path::new("/bin"), Path::new("/usr/bi:n")];
473 /// assert!(env::join_paths(paths.iter()).is_err());
477 /// Using `env::join_paths()` with [`env::split_paths()`] to append an item to
478 /// the `PATH` environment variable:
482 /// use std::path::PathBuf;
484 /// fn main() -> Result<(), env::JoinPathsError> {
485 /// if let Some(path) = env::var_os("PATH") {
486 /// let mut paths = env::split_paths(&path).collect::<Vec<_>>();
487 /// paths.push(PathBuf::from("/home/xyz/bin"));
488 /// let new_path = env::join_paths(paths)?;
489 /// env::set_var("PATH", &new_path);
496 /// [`env::split_paths()`]: split_paths
497 #[stable(feature = "env", since = "1.0.0")]
498 pub fn join_paths
<I
, T
>(paths
: I
) -> Result
<OsString
, JoinPathsError
>
500 I
: IntoIterator
<Item
= T
>,
503 os_imp
::join_paths(paths
.into_iter()).map_err(|e
| JoinPathsError { inner: e }
)
506 #[stable(feature = "env", since = "1.0.0")]
507 impl fmt
::Display
for JoinPathsError
{
508 fn fmt(&self, f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
513 #[stable(feature = "env", since = "1.0.0")]
514 impl Error
for JoinPathsError
{
515 #[allow(deprecated, deprecated_in_future)]
516 fn description(&self) -> &str {
517 self.inner
.description()
521 /// Returns the path of the current user's home directory if known.
525 /// - Returns the value of the 'HOME' environment variable if it is set
526 /// (including to an empty string).
527 /// - Otherwise, it tries to determine the home directory by invoking the `getpwuid_r` function
528 /// using the UID of the current user. An empty home directory field returned from the
529 /// `getpwuid_r` function is considered to be a valid value.
530 /// - Returns `None` if the current user has no entry in the /etc/passwd file.
534 /// - Returns the value of the 'HOME' environment variable if it is set
535 /// (including to an empty string).
536 /// - Otherwise, returns the value of the 'USERPROFILE' environment variable if it is set
537 /// (including to an empty string).
538 /// - If both do not exist, [`GetUserProfileDirectory`][msdn] is used to return the path.
540 /// [msdn]: https://docs.microsoft.com/en-us/windows/win32/api/userenv/nf-userenv-getuserprofiledirectorya
547 /// match env::home_dir() {
548 /// Some(path) => println!("Your home directory, probably: {}", path.display()),
549 /// None => println!("Impossible to get your home dir!"),
554 reason
= "This function's behavior is unexpected and probably not what you want. \
555 Consider using a crate from crates.io instead."
557 #[stable(feature = "env", since = "1.0.0")]
558 pub fn home_dir() -> Option
<PathBuf
> {
562 /// Returns the path of a temporary directory.
564 /// The temporary directory may be shared among users, or between processes
565 /// with different privileges; thus, the creation of any files or directories
566 /// in the temporary directory must use a secure method to create a uniquely
567 /// named file. Creating a file or directory with a fixed or predictable name
568 /// may result in "insecure temporary file" security vulnerabilities. Consider
569 /// using a crate that securely creates temporary files or directories.
573 /// Returns the value of the `TMPDIR` environment variable if it is
574 /// set, otherwise for non-Android it returns `/tmp`. If Android, since there
575 /// is no global temporary folder (it is usually allocated per-app), it returns
576 /// `/data/local/tmp`.
580 /// Returns the value of, in order, the `TMP`, `TEMP`,
581 /// `USERPROFILE` environment variable if any are set and not the empty
582 /// string. Otherwise, `temp_dir` returns the path of the Windows directory.
583 /// This behavior is identical to that of [`GetTempPath`][msdn], which this
584 /// function uses internally.
586 /// [msdn]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppatha
592 /// let mut dir = env::temp_dir();
593 /// println!("Temporary directory: {}", dir.display());
596 #[stable(feature = "env", since = "1.0.0")]
597 pub fn temp_dir() -> PathBuf
{
601 /// Returns the full filesystem path of the current running executable.
603 /// # Platform-specific behavior
605 /// If the executable was invoked through a symbolic link, some platforms will
606 /// return the path of the symbolic link and other platforms will return the
607 /// path of the symbolic link’s target.
611 /// Acquiring the path of the current executable is a platform-specific operation
612 /// that can fail for a good number of reasons. Some errors can include, but not
613 /// be limited to, filesystem operations failing or general syscall failures.
617 /// The output of this function should not be used in anything that might have
618 /// security implications. For example:
622 /// println!("{:?}", std::env::current_exe());
626 /// On Linux systems, if this is compiled as `foo`:
631 /// Ok("/home/alex/foo")
634 /// And you make a hard link of the program:
640 /// When you run it, you won’t get the path of the original executable, you’ll
641 /// get the path of the hard link:
645 /// Ok("/home/alex/bar")
648 /// This sort of behavior has been known to [lead to privilege escalation] when
649 /// used incorrectly.
651 /// [lead to privilege escalation]: https://securityvulns.com/Wdocument183.html
658 /// match env::current_exe() {
659 /// Ok(exe_path) => println!("Path of this executable is: {}",
660 /// exe_path.display()),
661 /// Err(e) => println!("failed to get current exe path: {}", e),
664 #[stable(feature = "env", since = "1.0.0")]
665 pub fn current_exe() -> io
::Result
<PathBuf
> {
666 os_imp
::current_exe()
669 /// An iterator over the arguments of a process, yielding a [`String`] value for
672 /// This struct is created by [`env::args()`]. See its documentation
675 /// The first element is traditionally the path of the executable, but it can be
676 /// set to arbitrary text, and may not even exist. This means this property
677 /// should not be relied upon for security purposes.
679 /// [`env::args()`]: args
680 #[stable(feature = "env", since = "1.0.0")]
685 /// An iterator over the arguments of a process, yielding an [`OsString`] value
686 /// for each argument.
688 /// This struct is created by [`env::args_os()`]. See its documentation
691 /// The first element is traditionally the path of the executable, but it can be
692 /// set to arbitrary text, and may not even exist. This means this property
693 /// should not be relied upon for security purposes.
695 /// [`env::args_os()`]: args_os
696 #[stable(feature = "env", since = "1.0.0")]
698 inner
: sys
::args
::Args
,
701 /// Returns the arguments that this program was started with (normally passed
702 /// via the command line).
704 /// The first element is traditionally the path of the executable, but it can be
705 /// set to arbitrary text, and may not even exist. This means this property should
706 /// not be relied upon for security purposes.
708 /// On Unix systems the shell usually expands unquoted arguments with glob patterns
709 /// (such as `*` and `?`). On Windows this is not done, and such arguments are
712 /// On glibc Linux systems, arguments are retrieved by placing a function in `.init_array`.
713 /// Glibc passes `argc`, `argv`, and `envp` to functions in `.init_array`, as a non-standard
714 /// extension. This allows `std::env::args` to work even in a `cdylib` or `staticlib`, as it
715 /// does on macOS and Windows.
719 /// The returned iterator will panic during iteration if any argument to the
720 /// process is not valid unicode. If this is not desired,
721 /// use the [`args_os`] function instead.
728 /// // Prints each argument on a separate line
729 /// for argument in env::args() {
730 /// println!("{}", argument);
733 #[stable(feature = "env", since = "1.0.0")]
734 pub fn args() -> Args
{
735 Args { inner: args_os() }
738 /// Returns the arguments which this program was started with (normally passed
739 /// via the command line).
741 /// The first element is traditionally the path of the executable, but it can be
742 /// set to arbitrary text, and it may not even exist, so this property should
743 /// not be relied upon for security purposes.
745 /// On glibc Linux systems, arguments are retrieved by placing a function in ".init_array".
746 /// Glibc passes argc, argv, and envp to functions in ".init_array", as a non-standard extension.
747 /// This allows `std::env::args` to work even in a `cdylib` or `staticlib`, as it does on macOS
755 /// // Prints each argument on a separate line
756 /// for argument in env::args_os() {
757 /// println!("{:?}", argument);
760 #[stable(feature = "env", since = "1.0.0")]
761 pub fn args_os() -> ArgsOs
{
762 ArgsOs { inner: sys::args::args() }
765 #[stable(feature = "env_unimpl_send_sync", since = "1.26.0")]
766 impl !Send
for Args {}
768 #[stable(feature = "env_unimpl_send_sync", since = "1.26.0")]
769 impl !Sync
for Args {}
771 #[stable(feature = "env", since = "1.0.0")]
772 impl Iterator
for Args
{
774 fn next(&mut self) -> Option
<String
> {
775 self.inner
.next().map(|s
| s
.into_string().unwrap())
777 fn size_hint(&self) -> (usize, Option
<usize>) {
778 self.inner
.size_hint()
782 #[stable(feature = "env", since = "1.0.0")]
783 impl ExactSizeIterator
for Args
{
784 fn len(&self) -> usize {
787 fn is_empty(&self) -> bool
{
788 self.inner
.is_empty()
792 #[stable(feature = "env_iterators", since = "1.12.0")]
793 impl DoubleEndedIterator
for Args
{
794 fn next_back(&mut self) -> Option
<String
> {
795 self.inner
.next_back().map(|s
| s
.into_string().unwrap())
799 #[stable(feature = "std_debug", since = "1.16.0")]
800 impl fmt
::Debug
for Args
{
801 fn fmt(&self, f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
802 f
.debug_struct("Args").field("inner", &self.inner
.inner
.inner_debug()).finish()
806 #[stable(feature = "env_unimpl_send_sync", since = "1.26.0")]
807 impl !Send
for ArgsOs {}
809 #[stable(feature = "env_unimpl_send_sync", since = "1.26.0")]
810 impl !Sync
for ArgsOs {}
812 #[stable(feature = "env", since = "1.0.0")]
813 impl Iterator
for ArgsOs
{
814 type Item
= OsString
;
815 fn next(&mut self) -> Option
<OsString
> {
818 fn size_hint(&self) -> (usize, Option
<usize>) {
819 self.inner
.size_hint()
823 #[stable(feature = "env", since = "1.0.0")]
824 impl ExactSizeIterator
for ArgsOs
{
825 fn len(&self) -> usize {
828 fn is_empty(&self) -> bool
{
829 self.inner
.is_empty()
833 #[stable(feature = "env_iterators", since = "1.12.0")]
834 impl DoubleEndedIterator
for ArgsOs
{
835 fn next_back(&mut self) -> Option
<OsString
> {
836 self.inner
.next_back()
840 #[stable(feature = "std_debug", since = "1.16.0")]
841 impl fmt
::Debug
for ArgsOs
{
842 fn fmt(&self, f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
843 f
.debug_struct("ArgsOs").field("inner", &self.inner
.inner_debug()).finish()
847 /// Constants associated with the current target
848 #[stable(feature = "env", since = "1.0.0")]
850 use crate::sys
::env
::os
;
852 /// A string describing the architecture of the CPU that is currently
855 /// Some possible values:
868 #[stable(feature = "env", since = "1.0.0")]
869 pub const ARCH
: &str = env
!("STD_ENV_ARCH");
871 /// The family of the operating system. Example value is `unix`.
873 /// Some possible values:
877 #[stable(feature = "env", since = "1.0.0")]
878 pub const FAMILY
: &str = os
::FAMILY
;
880 /// A string describing the specific operating system in use.
881 /// Example value is `linux`.
883 /// Some possible values:
895 #[stable(feature = "env", since = "1.0.0")]
896 pub const OS
: &str = os
::OS
;
898 /// Specifies the filename prefix used for shared libraries on this
899 /// platform. Example value is `lib`.
901 /// Some possible values:
904 /// - `""` (an empty string)
905 #[stable(feature = "env", since = "1.0.0")]
906 pub const DLL_PREFIX
: &str = os
::DLL_PREFIX
;
908 /// Specifies the filename suffix used for shared libraries on this
909 /// platform. Example value is `.so`.
911 /// Some possible values:
916 #[stable(feature = "env", since = "1.0.0")]
917 pub const DLL_SUFFIX
: &str = os
::DLL_SUFFIX
;
919 /// Specifies the file extension used for shared libraries on this
920 /// platform that goes after the dot. Example value is `so`.
922 /// Some possible values:
927 #[stable(feature = "env", since = "1.0.0")]
928 pub const DLL_EXTENSION
: &str = os
::DLL_EXTENSION
;
930 /// Specifies the filename suffix used for executable binaries on this
931 /// platform. Example value is `.exe`.
933 /// Some possible values:
938 /// - `""` (an empty string)
939 #[stable(feature = "env", since = "1.0.0")]
940 pub const EXE_SUFFIX
: &str = os
::EXE_SUFFIX
;
942 /// Specifies the file extension, if any, used for executable binaries
943 /// on this platform. Example value is `exe`.
945 /// Some possible values:
948 /// - `""` (an empty string)
949 #[stable(feature = "env", since = "1.0.0")]
950 pub const EXE_EXTENSION
: &str = os
::EXE_EXTENSION
;