Rollup merge of #57499 - steveklabnik:gh47757, r=Mark-Simulacrum

note that FromStr does not work for borrowed types

Fixes #47757
This commit is contained in:
Mazdak Farrokhzad 2019-01-12 10:55:16 +01:00 committed by GitHub
commit dc6d86b04e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,8 +20,7 @@ pub mod pattern;
#[allow(missing_docs)]
pub mod lossy;
/// A trait to abstract the idea of creating a new instance of a type from a
/// string.
/// Parse a value from a string
///
/// `FromStr`'s [`from_str`] method is often used implicitly, through
/// [`str`]'s [`parse`] method. See [`parse`]'s documentation for examples.
@ -30,6 +29,11 @@ pub mod lossy;
/// [`str`]: ../../std/primitive.str.html
/// [`parse`]: ../../std/primitive.str.html#method.parse
///
/// `FromStr` does not have a lifetime parameter, and so you can only parse types
/// that do not contain a lifetime parameter themselves. In other words, you can
/// parse an `i32` with `FromStr`, but not a `&i32`. You can parse a struct that
/// contains an `i32`, but not one that contains an `&i32`.
///
/// # Examples
///
/// Basic implementation of `FromStr` on an example `Point` type: