impl Default for &mut str
This commit is contained in:
parent
d830f46b77
commit
0ff8d40fa1
2 changed files with 7 additions and 0 deletions
|
@ -1326,6 +1326,7 @@ fn test_str_default() {
|
||||||
|
|
||||||
t::<&str>();
|
t::<&str>();
|
||||||
t::<String>();
|
t::<String>();
|
||||||
|
t::<&mut str>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -3875,6 +3875,12 @@ impl<'a> Default for &'a str {
|
||||||
fn default() -> &'a str { "" }
|
fn default() -> &'a str { "" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[stable(feature = "default_mut_str", since = "1.28.0")]
|
||||||
|
impl<'a> Default for &'a mut str {
|
||||||
|
/// Creates an empty mutable str
|
||||||
|
fn default() -> &'a mut str { unsafe { from_utf8_unchecked_mut(&mut []) } }
|
||||||
|
}
|
||||||
|
|
||||||
/// An iterator over the non-whitespace substrings of a string,
|
/// An iterator over the non-whitespace substrings of a string,
|
||||||
/// separated by any amount of whitespace.
|
/// separated by any amount of whitespace.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue