Mention array<->tuple convs in docs
This commit is contained in:
parent
36f86936b2
commit
de105164ea
@ -610,6 +610,9 @@ mod prim_pointer {}
|
|||||||
/// if the element type allows it. As a stopgap, trait implementations are
|
/// if the element type allows it. As a stopgap, trait implementations are
|
||||||
/// statically generated up to size 32.
|
/// statically generated up to size 32.
|
||||||
///
|
///
|
||||||
|
/// Arrays of sizes from 1 to 12 (inclusive) implement [`From<Tuple>`], where `Tuple`
|
||||||
|
/// is a homogenous [prim@tuple] of appropriate length.
|
||||||
|
///
|
||||||
/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
|
/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
|
||||||
/// an array. Indeed, this provides most of the API for working with arrays.
|
/// an array. Indeed, this provides most of the API for working with arrays.
|
||||||
///
|
///
|
||||||
@ -672,6 +675,13 @@ mod prim_pointer {}
|
|||||||
/// move_away(roa);
|
/// move_away(roa);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// Arrays can be created from homogenous tuples of appropriate length:
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// let tuple: (u32, u32, u32) = (1, 2, 3);
|
||||||
|
/// let array: [u32; 3] = tuple.into();
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// # Editions
|
/// # Editions
|
||||||
///
|
///
|
||||||
/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call
|
/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call
|
||||||
@ -774,6 +784,7 @@ mod prim_pointer {}
|
|||||||
/// [`Borrow`]: borrow::Borrow
|
/// [`Borrow`]: borrow::Borrow
|
||||||
/// [`BorrowMut`]: borrow::BorrowMut
|
/// [`BorrowMut`]: borrow::BorrowMut
|
||||||
/// [slice pattern]: ../reference/patterns.html#slice-patterns
|
/// [slice pattern]: ../reference/patterns.html#slice-patterns
|
||||||
|
/// [`From<Tuple>`]: convert::From
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
mod prim_array {}
|
mod prim_array {}
|
||||||
|
|
||||||
@ -1000,7 +1011,9 @@ mod prim_str {}
|
|||||||
/// * [`Debug`]
|
/// * [`Debug`]
|
||||||
/// * [`Default`]
|
/// * [`Default`]
|
||||||
/// * [`Hash`]
|
/// * [`Hash`]
|
||||||
|
/// * [`From<[T; N]>`][from]
|
||||||
///
|
///
|
||||||
|
/// [from]: convert::From
|
||||||
/// [`Debug`]: fmt::Debug
|
/// [`Debug`]: fmt::Debug
|
||||||
/// [`Hash`]: hash::Hash
|
/// [`Hash`]: hash::Hash
|
||||||
///
|
///
|
||||||
@ -1051,6 +1064,13 @@ mod prim_str {}
|
|||||||
/// assert_eq!(y, 5);
|
/// assert_eq!(y, 5);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// Homogenous tuples can be created from arrays of appropriate length:
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// let array: [u32; 3] = [1, 2, 3];
|
||||||
|
/// let tuple: (u32, u32, u32) = array.into();
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
mod prim_tuple {}
|
mod prim_tuple {}
|
||||||
|
|
||||||
|
@ -610,6 +610,9 @@ mod prim_pointer {}
|
|||||||
/// if the element type allows it. As a stopgap, trait implementations are
|
/// if the element type allows it. As a stopgap, trait implementations are
|
||||||
/// statically generated up to size 32.
|
/// statically generated up to size 32.
|
||||||
///
|
///
|
||||||
|
/// Arrays of sizes from 1 to 12 (inclusive) implement [`From<Tuple>`], where `Tuple`
|
||||||
|
/// is a homogenous [prim@tuple] of appropriate length.
|
||||||
|
///
|
||||||
/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
|
/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
|
||||||
/// an array. Indeed, this provides most of the API for working with arrays.
|
/// an array. Indeed, this provides most of the API for working with arrays.
|
||||||
///
|
///
|
||||||
@ -672,6 +675,13 @@ mod prim_pointer {}
|
|||||||
/// move_away(roa);
|
/// move_away(roa);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// Arrays can be created from homogenous tuples of appropriate length:
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// let tuple: (u32, u32, u32) = (1, 2, 3);
|
||||||
|
/// let array: [u32; 3] = tuple.into();
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// # Editions
|
/// # Editions
|
||||||
///
|
///
|
||||||
/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call
|
/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call
|
||||||
@ -774,6 +784,7 @@ mod prim_pointer {}
|
|||||||
/// [`Borrow`]: borrow::Borrow
|
/// [`Borrow`]: borrow::Borrow
|
||||||
/// [`BorrowMut`]: borrow::BorrowMut
|
/// [`BorrowMut`]: borrow::BorrowMut
|
||||||
/// [slice pattern]: ../reference/patterns.html#slice-patterns
|
/// [slice pattern]: ../reference/patterns.html#slice-patterns
|
||||||
|
/// [`From<Tuple>`]: convert::From
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
mod prim_array {}
|
mod prim_array {}
|
||||||
|
|
||||||
@ -1000,7 +1011,9 @@ mod prim_str {}
|
|||||||
/// * [`Debug`]
|
/// * [`Debug`]
|
||||||
/// * [`Default`]
|
/// * [`Default`]
|
||||||
/// * [`Hash`]
|
/// * [`Hash`]
|
||||||
|
/// * [`From<[T; N]>`][from]
|
||||||
///
|
///
|
||||||
|
/// [from]: convert::From
|
||||||
/// [`Debug`]: fmt::Debug
|
/// [`Debug`]: fmt::Debug
|
||||||
/// [`Hash`]: hash::Hash
|
/// [`Hash`]: hash::Hash
|
||||||
///
|
///
|
||||||
@ -1051,6 +1064,13 @@ mod prim_str {}
|
|||||||
/// assert_eq!(y, 5);
|
/// assert_eq!(y, 5);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// Homogenous tuples can be created from arrays of appropriate length:
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// let array: [u32; 3] = [1, 2, 3];
|
||||||
|
/// let tuple: (u32, u32, u32) = array.into();
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
mod prim_tuple {}
|
mod prim_tuple {}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user