1
Fork 0

Convert str -> prim@str in std

This commit is contained in:
Joshua Nelson 2020-08-22 16:29:55 -04:00
parent 373432e47f
commit 6f4681bacc
4 changed files with 10 additions and 4 deletions

View file

@ -296,6 +296,8 @@ impl From<String> for Box<dyn Error> {
impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> { impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
/// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`]. /// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`].
/// ///
/// [`str`]: prim@str
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -317,6 +319,8 @@ impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
impl From<&str> for Box<dyn Error> { impl From<&str> for Box<dyn Error> {
/// Converts a [`str`] into a box of dyn [`Error`]. /// Converts a [`str`] into a box of dyn [`Error`].
/// ///
/// [`str`]: prim@str
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```

View file

@ -69,7 +69,7 @@ use crate::sys;
/// extern functions. See the documentation for that function for a /// extern functions. See the documentation for that function for a
/// discussion on ensuring the lifetime of the raw pointer. /// discussion on ensuring the lifetime of the raw pointer.
/// ///
/// [`&str`]: str /// [`&str`]: prim@str
/// [slice.as_ptr]: ../primitive.slice.html#method.as_ptr /// [slice.as_ptr]: ../primitive.slice.html#method.as_ptr
/// [slice.len]: ../primitive.slice.html#method.len /// [slice.len]: ../primitive.slice.html#method.len
/// [`Deref`]: ops::Deref /// [`Deref`]: ops::Deref
@ -180,7 +180,7 @@ pub struct CString {
/// println!("string: {}", my_string_safe()); /// println!("string: {}", my_string_safe());
/// ``` /// ```
/// ///
/// [`&str`]: str /// [`&str`]: prim@str
#[derive(Hash)] #[derive(Hash)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
// FIXME: // FIXME:
@ -1351,7 +1351,7 @@ impl CStr {
/// function will return the corresponding [`&str`] slice. Otherwise, /// function will return the corresponding [`&str`] slice. Otherwise,
/// it will return an error with details of where UTF-8 validation failed. /// it will return an error with details of where UTF-8 validation failed.
/// ///
/// [`&str`]: str /// [`&str`]: prim@str
/// ///
/// # Examples /// # Examples
/// ///
@ -1379,6 +1379,7 @@ impl CStr {
/// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD] and return a /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD] and return a
/// [`Cow`]`::`[`Owned`]`(`[`String`]`)` with the result. /// [`Cow`]`::`[`Owned`]`(`[`String`]`)` with the result.
/// ///
/// [`str`]: prim@str
/// [`Borrowed`]: Cow::Borrowed /// [`Borrowed`]: Cow::Borrowed
/// [`Owned`]: Cow::Owned /// [`Owned`]: Cow::Owned
/// [U+FFFD]: crate::char::REPLACEMENT_CHARACTER /// [U+FFFD]: crate::char::REPLACEMENT_CHARACTER

View file

@ -480,7 +480,7 @@ where
/// ``` /// ```
/// ///
/// [`read()`]: Read::read /// [`read()`]: Read::read
/// [`&str`]: str /// [`&str`]: prim@str
/// [`std::io`]: self /// [`std::io`]: self
/// [`File`]: crate::fs::File /// [`File`]: crate::fs::File
/// [slice]: ../../std/primitive.slice.html /// [slice]: ../../std/primitive.slice.html

View file

@ -172,6 +172,7 @@
//! [`Vec<T>`]: vec::Vec //! [`Vec<T>`]: vec::Vec
//! [`atomic`]: sync::atomic //! [`atomic`]: sync::atomic
//! [`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for //! [`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
//! [`str`]: prim@str
//! [`mpsc`]: sync::mpsc //! [`mpsc`]: sync::mpsc
//! [`std::cmp`]: cmp //! [`std::cmp`]: cmp
//! [`std::slice`]: slice //! [`std::slice`]: slice