Skip to content

Add links between slice::{copy,clone}_from_slice in docs. #41784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,9 @@ impl<T> [T] {
///
/// The length of `src` must be the same as `self`.
///
/// If `src` implements `Copy`, it can be more performant to use
/// [`copy_from_slice`].
///
/// # Panics
///
/// This function will panic if the two slices have different lengths.
Expand All @@ -1354,6 +1357,8 @@ impl<T> [T] {
/// dst.clone_from_slice(&src);
/// assert!(dst == [1, 2, 3]);
/// ```
///
/// [`copy_from_slice`]: #method.copy_from_slice
#[stable(feature = "clone_from_slice", since = "1.7.0")]
pub fn clone_from_slice(&mut self, src: &[T]) where T: Clone {
core_slice::SliceExt::clone_from_slice(self, src)
Expand All @@ -1363,6 +1368,8 @@ impl<T> [T] {
///
/// The length of `src` must be the same as `self`.
///
/// If `src` does not implement `Copy`, use [`clone_from_slice`].
///
/// # Panics
///
/// This function will panic if the two slices have different lengths.
Expand All @@ -1376,6 +1383,8 @@ impl<T> [T] {
/// dst.copy_from_slice(&src);
/// assert_eq!(src, dst);
/// ```
///
/// [`clone_from_slice`]: #method.clone_from_slice
#[stable(feature = "copy_from_slice", since = "1.9.0")]
pub fn copy_from_slice(&mut self, src: &[T]) where T: Copy {
core_slice::SliceExt::copy_from_slice(self, src)
Expand Down