diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-09-14 17:15:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-14 17:15:37 +0200 |
| commit | a89690ec00ca98397183c3ef011f944448098f8b (patch) | |
| tree | 223b94f42aed89fbfb7fd84a474cf2bb64b45694 /src/libstd | |
| parent | 4476b7b43b2826b6f0e71f4638159f8718c0a440 (diff) | |
| parent | 5798003438469313c0616270b8b285d9afbb4730 (diff) | |
| download | rust-a89690ec00ca98397183c3ef011f944448098f8b.tar.gz rust-a89690ec00ca98397183c3ef011f944448098f8b.zip | |
Rollup merge of #36396 - athulappadan:Default-docs, r=bluss
Documentation of what Default does for each type Addresses #36265 I haven't changed the following types due to doubts: 1)src/libstd/ffi/c_str.rs 2)src/libcore/iter/sources.rs 3)src/libcore/hash/mod.rs 4)src/libcore/hash/mod.rs 5)src/librustc/middle/privacy.rs r? @steveklabnik
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 2 | ||||
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 1 | ||||
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 1 | ||||
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sync/condvar.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sync/mutex.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sync/rwlock.rs | 1 |
7 files changed, 9 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 4eb2c8f0644..eb1653f18cb 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1218,6 +1218,7 @@ impl<K, V, S> Default for HashMap<K, V, S> where K: Eq + Hash, S: BuildHasher + Default, { + /// Creates an empty `HashMap<K, V, S>`, with the `Default` value for the hasher. fn default() -> HashMap<K, V, S> { HashMap::with_hasher(Default::default()) } @@ -2026,6 +2027,7 @@ impl Hasher for DefaultHasher { #[stable(feature = "rust1", since = "1.0.0")] impl Default for RandomState { + /// Constructs a new `RandomState`. #[inline] fn default() -> RandomState { RandomState::new() diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index ca5137e9573..ff56747fee6 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -665,6 +665,7 @@ impl<T, S> Default for HashSet<T, S> where T: Eq + Hash, S: BuildHasher + Default, { + /// Creates an empty `HashSet<T, S>` with the `Default` value for the hasher. fn default() -> HashSet<T, S> { HashSet::with_hasher(Default::default()) } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 2d5e8c04194..1c449712e1f 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -361,6 +361,7 @@ impl<'a> Default for &'a CStr { #[stable(feature = "cstr_default", since = "1.10.0")] impl Default for CString { + /// Creates an empty `CString`. fn default() -> CString { let a: &CStr = Default::default(); a.to_owned() diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 36cf4ef758d..d93d3c73622 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -170,6 +170,7 @@ impl ops::Deref for OsString { #[stable(feature = "osstring_default", since = "1.9.0")] impl Default for OsString { + /// Constructs an empty `OsString`. #[inline] fn default() -> OsString { OsString::new() @@ -342,6 +343,7 @@ impl OsStr { #[stable(feature = "osstring_default", since = "1.9.0")] impl<'a> Default for &'a OsStr { + /// Creates an empty `OsStr`. #[inline] fn default() -> &'a OsStr { OsStr::new("") diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 4c946e613ea..3db8b05b954 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -241,6 +241,7 @@ impl Condvar { #[stable(feature = "condvar_default", since = "1.9.0")] impl Default for Condvar { + /// Creates a `Condvar` which is ready to be waited on and notified. fn default() -> Condvar { Condvar::new() } diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index c8ae88c2331..098a3e44258 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -287,6 +287,7 @@ impl<T: ?Sized> Drop for Mutex<T> { #[stable(feature = "mutex_default", since = "1.9.0")] impl<T: ?Sized + Default> Default for Mutex<T> { + /// Creates a `Mutex<T>`, with the `Default` value for T. fn default() -> Mutex<T> { Mutex::new(Default::default()) } diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 4801bcffd08..7f053c6704b 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -311,6 +311,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> { #[stable(feature = "rw_lock_default", since = "1.9.0")] impl<T: Default> Default for RwLock<T> { + /// Creates a new `RwLock<T>`, with the `Default` value for T. fn default() -> RwLock<T> { RwLock::new(Default::default()) } |
