@@ -261,7 +261,20 @@ pub fn set_var<K: ?Sized, V: ?Sized>(k: &K, v: &V)
261261 os_imp:: setenv ( k. as_os_str ( ) , v. as_os_str ( ) )
262262}
263263
264- /// Remove a variable from the environment entirely.
264+ /// Remove an environment variable from the environment of the currently running process.
265+ ///
266+ /// # Examples
267+ ///
268+ /// ```
269+ /// use std::env;
270+ ///
271+ /// let key = "KEY";
272+ /// env::set_var(key, "VALUE");
273+ /// assert_eq!(env::var(key), Ok("VALUE".to_string()));
274+ ///
275+ /// env::remove_var(key);
276+ /// assert!(env::var(key).is_err());
277+ /// ```
265278#[ stable( feature = "env" , since = "1.0.0" ) ]
266279pub fn remove_var < K : ?Sized > ( k : & K ) where K : AsOsStr {
267280 let _g = ENV_LOCK . lock ( ) ;
@@ -398,6 +411,19 @@ pub fn home_dir() -> Option<PathBuf> {
398411/// On Windows, returns the value of, in order, the 'TMP', 'TEMP',
399412/// 'USERPROFILE' environment variable if any are set and not the empty
400413/// string. Otherwise, tmpdir returns the path to the Windows directory.
414+ ///
415+ /// ```
416+ /// use std::env;
417+ /// use std::fs::File;
418+ ///
419+ /// # fn foo() -> std::io::Result<()> {
420+ /// let mut dir = env::temp_dir();
421+ /// dir.push("foo.txt");
422+ ///
423+ /// let f = try!(File::create(dir));
424+ /// # Ok(())
425+ /// # }
426+ /// ```
401427#[ stable( feature = "env" , since = "1.0.0" ) ]
402428pub fn temp_dir ( ) -> PathBuf {
403429 os_imp:: temp_dir ( )
@@ -557,6 +583,7 @@ pub mod consts {
557583 #[ stable( feature = "env" , since = "1.0.0" ) ]
558584 pub const ARCH : & ' static str = super :: arch:: ARCH ;
559585
586+ /// The family of the operating system. In this case, `unix`.
560587 #[ stable( feature = "env" , since = "1.0.0" ) ]
561588 pub const FAMILY : & ' static str = super :: os:: FAMILY ;
562589
0 commit comments