diff options
| author | athulappadan <a4athulappadan@gmail.com> | 2016-09-11 17:00:09 +0530 |
|---|---|---|
| committer | athulappadan <a4athulappadan@gmail.com> | 2016-09-11 17:00:09 +0530 |
| commit | 49e77dbf25ed6526fb5d37c32e55797fb04522f0 (patch) | |
| tree | c876b159c4833fe3a5f2c91dadb2194d77bfc057 /src/libcore | |
| parent | 1fca1ab0e7be574022b2d229f0a6ad9bd580d1bf (diff) | |
| download | rust-49e77dbf25ed6526fb5d37c32e55797fb04522f0.tar.gz rust-49e77dbf25ed6526fb5d37c32e55797fb04522f0.zip | |
Documentation of what does for each type
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cell.rs | 3 | ||||
| -rw-r--r-- | src/libcore/hash/sip.rs | 1 | ||||
| -rw-r--r-- | src/libcore/option.rs | 1 | ||||
| -rw-r--r-- | src/libcore/slice.rs | 2 | ||||
| -rw-r--r-- | src/libcore/str/mod.rs | 1 | ||||
| -rw-r--r-- | src/libcore/sync/atomic.rs | 2 |
6 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index f0710a1d935..51221f1b9b9 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -317,6 +317,7 @@ impl<T:Copy> Clone for Cell<T> { #[stable(feature = "rust1", since = "1.0.0")] impl<T:Default + Copy> Default for Cell<T> { + /// Creates a `Cell<T>`, with the `Default` value for T. #[inline] fn default() -> Cell<T> { Cell::new(Default::default()) @@ -758,6 +759,7 @@ impl<T: Clone> Clone for RefCell<T> { #[stable(feature = "rust1", since = "1.0.0")] impl<T:Default> Default for RefCell<T> { + /// Creates a `RefCell<T>`, with the `Default` value for T. #[inline] fn default() -> RefCell<T> { RefCell::new(Default::default()) @@ -1139,6 +1141,7 @@ impl<T: ?Sized> UnsafeCell<T> { #[stable(feature = "unsafe_cell_default", since = "1.9.0")] impl<T: Default> Default for UnsafeCell<T> { + /// Creates an `UnsafeCell`, with the `Default` value for T. fn default() -> UnsafeCell<T> { UnsafeCell::new(Default::default()) } diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index bd6cae92b05..dc53683d633 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -333,6 +333,7 @@ impl<S: Sip> Clone for Hasher<S> { } impl<S: Sip> Default for Hasher<S> { + /// Creates a `Hasher<S>` with the two initial keys set to 0. #[inline] fn default() -> Hasher<S> { Hasher::new_with_keys(0, 0) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index cf52849e019..4c449c6562e 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -698,6 +698,7 @@ fn expect_failed(msg: &str) -> ! { #[stable(feature = "rust1", since = "1.0.0")] impl<T> Default for Option<T> { + /// Creates an instance of None. #[inline] fn default() -> Option<T> { None } } diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index b22bdb43414..53d2b3ded67 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -755,11 +755,13 @@ impl<T> ops::IndexMut<ops::RangeToInclusive<usize>> for [T] { #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Default for &'a [T] { + /// Creates an empty Slice. fn default() -> &'a [T] { &[] } } #[stable(feature = "mut_slice_default", since = "1.5.0")] impl<'a, T> Default for &'a mut [T] { + /// Creates a mutable empty Slice. fn default() -> &'a mut [T] { &mut [] } } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 18e43c02c64..1f1ae6f12ab 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1987,5 +1987,6 @@ impl AsRef<[u8]> for str { #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Default for &'a str { + /// Creates an empty str fn default() -> &'a str { "" } } diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 75ddd2021a8..a5efda702df 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -95,6 +95,7 @@ pub struct AtomicBool { #[cfg(target_has_atomic = "8")] #[stable(feature = "rust1", since = "1.0.0")] impl Default for AtomicBool { + /// Creates an `AtomicBool` initialised as false. fn default() -> Self { Self::new(false) } @@ -117,6 +118,7 @@ pub struct AtomicPtr<T> { #[cfg(target_has_atomic = "ptr")] #[stable(feature = "rust1", since = "1.0.0")] impl<T> Default for AtomicPtr<T> { + /// Creates an `AtomicPtr<T>` with an initial mutable null pointer. fn default() -> AtomicPtr<T> { AtomicPtr::new(::ptr::null_mut()) } |
