diff options
| author | bors <bors@rust-lang.org> | 2017-01-30 13:16:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-01-30 13:16:57 +0000 |
| commit | 55f9712d14126bce39357e6160a638ce7886e982 (patch) | |
| tree | 698eb4df8451184da7a7ac88438f7ef199a0f3d1 | |
| parent | c8699376cd961684a73505612471f0f08710ba0b (diff) | |
| parent | 19c9f18b2c89558300d5b71d47928878edb8bf97 (diff) | |
| download | rust-55f9712d14126bce39357e6160a638ce7886e982.tar.gz rust-55f9712d14126bce39357e6160a638ce7886e982.zip | |
Auto merge of #39407 - GuillaumeGomez:convert_module, r=frewsxcv
Add missing url in convert module r? @frewsxcv
| -rw-r--r-- | src/libcore/convert.rs | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 830bbc079ad..abd686b15e2 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -18,25 +18,33 @@ //! support arguments of multiple types. //! //! - Impl the `As*` traits for reference-to-reference conversions -//! - Impl the `Into` trait when you want to consume the value in the conversion -//! - The `From` trait is the most flexible, useful for value _and_ reference conversions -//! - The `TryFrom` and `TryInto` traits behave like `From` and `Into`, but allow for the +//! - Impl the [`Into`] trait when you want to consume the value in the conversion +//! - The [`From`] trait is the most flexible, useful for value _and_ reference conversions +//! - The [`TryFrom`] and [`TryInto`] traits behave like [`From`] and [`Into`], but allow for the //! conversion to fail //! -//! As a library author, you should prefer implementing `From<T>` or `TryFrom<T>` rather than -//! `Into<U>` or `TryInto<U>`, as `From` and `TryFrom` provide greater flexibility and offer -//! equivalent `Into` or `TryInto` implementations for free, thanks to a blanket implementation +//! As a library author, you should prefer implementing [`From<T>`][`From`] or +//! [`TryFrom<T>`][`TryFrom`] rather than [`Into<U>`][`Into`] or [`TryInto<U>`][`TryInto`], +//! as [`From`] and [`TryFrom`] provide greater flexibility and offer +//! equivalent [`Into`] or [`TryInto`] implementations for free, thanks to a blanket implementation //! in the standard library. //! //! # Generic impl //! -//! - `AsRef` and `AsMut` auto-dereference if the inner type is a reference -//! - `From<U> for T` implies `Into<T> for U` -//! - `TryFrom<U> for T` implies `TryInto<T> for U` -//! - `From` and `Into` are reflexive, which means that all types can `into()` +//! - [`AsRef`] and [`AsMut`] auto-dereference if the inner type is a reference +//! - [`From`]`<U> for T` implies [`Into`]`<T> for U` +//! - [`TryFrom`]`<U> for T` implies [`TryInto`]`<T> for U` +//! - [`From`] and [`Into`] are reflexive, which means that all types can `into()` //! themselves and `from()` themselves //! //! See each trait for usage examples. +//! +//! [`Into`]: trait.Into.html +//! [`From`]: trait.From.html +//! [`TryFrom`]: trait.TryFrom.html +//! [`TryInto`]: trait.TryInto.html +//! [`AsRef`]: trait.AsRef.html +//! [`AsMut`]: trait.AsMut.html #![stable(feature = "rust1", since = "1.0.0")] |
