Documentation for default types modified
This commit is contained in:
parent
49e77dbf25
commit
41881e85bd
13 changed files with 12 additions and 15 deletions
|
|
@ -718,7 +718,7 @@ impl<T: ?Sized> Clone for Weak<T> {
|
|||
|
||||
#[stable(feature = "downgraded_weak", since = "1.10.0")]
|
||||
impl<T> Default for Weak<T> {
|
||||
/// Creates a new `Weak<T>`.
|
||||
/// Constructs a new `Weak<T>` without an accompanying instance of T.
|
||||
fn default() -> Weak<T> {
|
||||
Weak::new()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ impl<'a, B: ?Sized> Default for Cow<'a, B>
|
|||
where B: ToOwned,
|
||||
<B as ToOwned>::Owned: Default
|
||||
{
|
||||
/// Creates a `Cow<'a, B>` pointer.
|
||||
/// Creates an owned Cow<'a, B> with the default value for the contained owned value.
|
||||
fn default() -> Cow<'a, B> {
|
||||
Owned(<B as ToOwned>::Owned::default())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -674,7 +674,7 @@ impl<'a, T: 'a + Ord + Copy> Extend<&'a T> for BTreeSet<T> {
|
|||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Ord> Default for BTreeSet<T> {
|
||||
/// Creates a new `BTreeSet<T>`.
|
||||
/// Makes a empty `BTreeSet<T>` with a reasonable choice of B.
|
||||
fn default() -> BTreeSet<T> {
|
||||
BTreeSet::new()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ impl<T> Drop for VecDeque<T> {
|
|||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Default for VecDeque<T> {
|
||||
/// Creates a `VecDeque<T>` with a constant initial capacity.
|
||||
/// Creates an empty `VecDeque<T>`.
|
||||
#[inline]
|
||||
fn default() -> VecDeque<T> {
|
||||
VecDeque::new()
|
||||
|
|
|
|||
|
|
@ -698,7 +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.
|
||||
/// Returns None.
|
||||
#[inline]
|
||||
fn default() -> Option<T> { None }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -755,13 +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.
|
||||
/// 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.
|
||||
/// Creates a mutable empty slice.
|
||||
fn default() -> &'a mut [T] { &mut [] }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +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.
|
||||
/// Creates a null `AtomicPtr<T>`.
|
||||
fn default() -> AtomicPtr<T> {
|
||||
AtomicPtr::new(::ptr::null_mut())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ struct MyHasher {
|
|||
}
|
||||
|
||||
impl Default for MyHasher {
|
||||
/// Constructs a `MyHasher` with initial value zero.
|
||||
fn default() -> MyHasher {
|
||||
MyHasher { hash: 0 }
|
||||
}
|
||||
|
|
@ -91,7 +90,6 @@ impl Hasher for CustomHasher {
|
|||
}
|
||||
|
||||
impl Default for CustomHasher {
|
||||
/// Constructs a `CustomHasher` with initial value zero.
|
||||
fn default() -> CustomHasher {
|
||||
CustomHasher { output: 0 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ pub enum ErrorOutputType {
|
|||
}
|
||||
|
||||
impl Default for ErrorOutputType {
|
||||
/// Creates an `HumanReadble`, initialised with `ColorConfig` enum type `Auto`.
|
||||
fn default() -> ErrorOutputType {
|
||||
ErrorOutputType::HumanReadable(ColorConfig::Auto)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1218,7 +1218,7 @@ impl<K, V, S> Default for HashMap<K, V, S>
|
|||
where K: Eq + Hash,
|
||||
S: BuildHasher + Default,
|
||||
{
|
||||
/// Creates a `HashMap<K, V, S>`, with initial `Default` hasher.
|
||||
/// 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())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -665,7 +665,7 @@ impl<T, S> Default for HashSet<T, S>
|
|||
where T: Eq + Hash,
|
||||
S: BuildHasher + Default,
|
||||
{
|
||||
/// Creates a `HashSet<T, S>` with initial `Default` hasher.
|
||||
/// Creates an empty `HashSet<T, S>` with the `Default` value for the hasher.
|
||||
fn default() -> HashSet<T, S> {
|
||||
HashSet::with_hasher(Default::default())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ impl<'a> Default for &'a CStr {
|
|||
|
||||
#[stable(feature = "cstr_default", since = "1.10.0")]
|
||||
impl Default for CString {
|
||||
/// Creates a new `CString`, by calling the `Default` of `CStr`, and then owns it.
|
||||
/// Creates an empty `CString`.
|
||||
fn default() -> CString {
|
||||
let a: &CStr = Default::default();
|
||||
a.to_owned()
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ impl<T> P<[T]> {
|
|||
}
|
||||
|
||||
impl<T> Default for P<[T]> {
|
||||
/// Creates a new `P`, with the `Default` value for T.
|
||||
/// Creates an empty `P<[T]>`.
|
||||
fn default() -> P<[T]> {
|
||||
P::new()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue