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.
566 /// Returns the value of the `TMPDIR` environment variable if it is
567 /// set, otherwise for non-Android it returns `/tmp`. If Android, since there
568 /// is no global temporary folder (it is usually allocated per-app), it returns
569 /// `/data/local/tmp`.
573 /// Returns the value of, in order, the `TMP`, `TEMP`,
574 /// `USERPROFILE` environment variable if any are set and not the empty
575 /// string. Otherwise, `temp_dir` returns the path of the Windows directory.
576 /// This behavior is identical to that of [`GetTempPath`][msdn], which this
577 /// function uses internally.
579 /// [msdn]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppatha
583 /// use std::fs::File;
585 /// fn main() -> std::io::Result<()> {
586 /// let mut dir = env::temp_dir();
587 /// dir.push("foo.txt");
589 /// let f = File::create(dir)?;
593 #[stable(feature = "env", since = "1.0.0")]
594 pub fn temp_dir() -> PathBuf {
598 /// Returns the full filesystem path of the current running executable.
600 /// # Platform-specific behavior
602 /// If the executable was invoked through a symbolic link, some platforms will
603 /// return the path of the symbolic link and other platforms will return the
604 /// path of the symbolic link’s target.
608 /// Acquiring the path of the current executable is a platform-specific operation
609 /// that can fail for a good number of reasons. Some errors can include, but not
610 /// be limited to, filesystem operations failing or general syscall failures.
614 /// The output of this function should not be used in anything that might have
615 /// security implications. For example:
619 /// println!("{:?}", std::env::current_exe());
623 /// On Linux systems, if this is compiled as `foo`:
628 /// Ok("/home/alex/foo")
631 /// And you make a hard link of the program:
637 /// When you run it, you won’t get the path of the original executable, you’ll
638 /// get the path of the hard link:
642 /// Ok("/home/alex/bar")
645 /// This sort of behavior has been known to [lead to privilege escalation] when
646 /// used incorrectly.
648 /// [lead to privilege escalation]: https://securityvulns.com/Wdocument183.html
655 /// match env::current_exe() {
656 /// Ok(exe_path) => println!("Path of this executable is: {}",
657 /// exe_path.display()),
658 /// Err(e) => println!("failed to get current exe path: {}", e),
661 #[stable(feature = "env", since = "1.0.0")]
662 pub fn current_exe() -> io::Result<PathBuf> {
663 os_imp::current_exe()
666 /// An iterator over the arguments of a process, yielding a [`String`] value for
669 /// This struct is created by [`env::args()`]. See its documentation
672 /// The first element is traditionally the path of the executable, but it can be
673 /// set to arbitrary text, and may not even exist. This means this property
674 /// should not be relied upon for security purposes.
676 /// [`env::args()`]: args
677 #[stable(feature = "env", since = "1.0.0")]
682 /// An iterator over the arguments of a process, yielding an [`OsString`] value
683 /// for each argument.
685 /// This struct is created by [`env::args_os()`]. See its documentation
688 /// The first element is traditionally the path of the executable, but it can be
689 /// set to arbitrary text, and may not even exist. This means this property
690 /// should not be relied upon for security purposes.
692 /// [`env::args_os()`]: args_os
693 #[stable(feature = "env", since = "1.0.0")]
695 inner: sys::args::Args,
698 /// Returns the arguments that this program was started with (normally passed
699 /// via the command line).
701 /// The first element is traditionally the path of the executable, but it can be
702 /// set to arbitrary text, and may not even exist. This means this property should
703 /// not be relied upon for security purposes.
705 /// On Unix systems the shell usually expands unquoted arguments with glob patterns
706 /// (such as `*` and `?`). On Windows this is not done, and such arguments are
709 /// On glibc Linux systems, arguments are retrieved by placing a function in `.init_array`.
710 /// Glibc passes `argc`, `argv`, and `envp` to functions in `.init_array`, as a non-standard
711 /// extension. This allows `std::env::args` to work even in a `cdylib` or `staticlib`, as it
712 /// does on macOS and Windows.
716 /// The returned iterator will panic during iteration if any argument to the
717 /// process is not valid unicode. If this is not desired,
718 /// use the [`args_os`] function instead.
725 /// // Prints each argument on a separate line
726 /// for argument in env::args() {
727 /// println!("{}", argument);
730 #[stable(feature = "env", since = "1.0.0")]
731 pub fn args() -> Args {
732 Args { inner: args_os() }
735 /// Returns the arguments which this program was started with (normally passed
736 /// via the command line).
738 /// The first element is traditionally the path of the executable, but it can be
739 /// set to arbitrary text, and it may not even exist, so this property should
740 /// not be relied upon for security purposes.
742 /// On glibc Linux systems, arguments are retrieved by placing a function in ".init_array".
743 /// Glibc passes argc, argv, and envp to functions in ".init_array", as a non-standard extension.
744 /// This allows `std::env::args` to work even in a `cdylib` or `staticlib`, as it does on macOS
752 /// // Prints each argument on a separate line
753 /// for argument in env::args_os() {
754 /// println!("{:?}", argument);
757 #[stable(feature = "env", since = "1.0.0")]
758 pub fn args_os() -> ArgsOs {
759 ArgsOs { inner: sys::args::args() }
762 #[stable(feature = "env_unimpl_send_sync", since = "1.26.0")]
763 impl !Send for Args {}
765 #[stable(feature = "env_unimpl_send_sync", since = "1.26.0")]
766 impl !Sync for Args {}
768 #[stable(feature = "env", since = "1.0.0")]
769 impl Iterator for Args {
771 fn next(&mut self) -> Option<String> {
772 self.inner.next().map(|s| s.into_string().unwrap())
774 fn size_hint(&self) -> (usize, Option<usize>) {
775 self.inner.size_hint()
779 #[stable(feature = "env", since = "1.0.0")]
780 impl ExactSizeIterator for Args {
781 fn len(&self) -> usize {
784 fn is_empty(&self) -> bool {
785 self.inner.is_empty()
789 #[stable(feature = "env_iterators", since = "1.12.0")]
790 impl DoubleEndedIterator for Args {
791 fn next_back(&mut self) -> Option<String> {
792 self.inner.next_back().map(|s| s.into_string().unwrap())
796 #[stable(feature = "std_debug", since = "1.16.0")]
797 impl fmt::Debug for Args {
798 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
799 f.debug_struct("Args").field("inner", &self.inner.inner.inner_debug()).finish()
803 #[stable(feature = "env_unimpl_send_sync", since = "1.26.0")]
804 impl !Send for ArgsOs {}
806 #[stable(feature = "env_unimpl_send_sync", since = "1.26.0")]
807 impl !Sync for ArgsOs {}
809 #[stable(feature = "env", since = "1.0.0")]
810 impl Iterator for ArgsOs {
811 type Item = OsString;
812 fn next(&mut self) -> Option<OsString> {
815 fn size_hint(&self) -> (usize, Option<usize>) {
816 self.inner.size_hint()
820 #[stable(feature = "env", since = "1.0.0")]
821 impl ExactSizeIterator for ArgsOs {
822 fn len(&self) -> usize {
825 fn is_empty(&self) -> bool {
826 self.inner.is_empty()
830 #[stable(feature = "env_iterators", since = "1.12.0")]
831 impl DoubleEndedIterator for ArgsOs {
832 fn next_back(&mut self) -> Option<OsString> {
833 self.inner.next_back()
837 #[stable(feature = "std_debug", since = "1.16.0")]
838 impl fmt::Debug for ArgsOs {
839 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
840 f.debug_struct("ArgsOs").field("inner", &self.inner.inner_debug()).finish()
844 /// Constants associated with the current target
845 #[stable(feature = "env", since = "1.0.0")]
847 use crate::sys::env::os;
849 /// A string describing the architecture of the CPU that is currently
852 /// Some possible values:
865 #[stable(feature = "env", since = "1.0.0")]
866 pub const ARCH: &str = env!("STD_ENV_ARCH");
868 /// The family of the operating system. Example value is `unix`.
870 /// Some possible values:
874 #[stable(feature = "env", since = "1.0.0")]
875 pub const FAMILY: &str = os::FAMILY;
877 /// A string describing the specific operating system in use.
878 /// Example value is `linux`.
880 /// Some possible values:
892 #[stable(feature = "env", since = "1.0.0")]
893 pub const OS: &str = os::OS;
895 /// Specifies the filename prefix used for shared libraries on this
896 /// platform. Example value is `lib`.
898 /// Some possible values:
901 /// - `""` (an empty string)
902 #[stable(feature = "env", since = "1.0.0")]
903 pub const DLL_PREFIX: &str = os::DLL_PREFIX;
905 /// Specifies the filename suffix used for shared libraries on this
906 /// platform. Example value is `.so`.
908 /// Some possible values:
913 #[stable(feature = "env", since = "1.0.0")]
914 pub const DLL_SUFFIX: &str = os::DLL_SUFFIX;
916 /// Specifies the file extension used for shared libraries on this
917 /// platform that goes after the dot. Example value is `so`.
919 /// Some possible values:
924 #[stable(feature = "env", since = "1.0.0")]
925 pub const DLL_EXTENSION: &str = os::DLL_EXTENSION;
927 /// Specifies the filename suffix used for executable binaries on this
928 /// platform. Example value is `.exe`.
930 /// Some possible values:
935 /// - `""` (an empty string)
936 #[stable(feature = "env", since = "1.0.0")]
937 pub const EXE_SUFFIX: &str = os::EXE_SUFFIX;
939 /// Specifies the file extension, if any, used for executable binaries
940 /// on this platform. Example value is `exe`.
942 /// Some possible values:
945 /// - `""` (an empty string)
946 #[stable(feature = "env", since = "1.0.0")]
947 pub const EXE_EXTENSION: &str = os::EXE_EXTENSION;