@@ -1341,6 +1341,9 @@ impl<T> [T] {
1341
1341
///
1342
1342
/// The length of `src` must be the same as `self`.
1343
1343
///
1344
+ /// If `src` implements `Copy`, it can be more performant to use
1345
+ /// [`copy_from_slice`].
1346
+ ///
1344
1347
/// # Panics
1345
1348
///
1346
1349
/// This function will panic if the two slices have different lengths.
@@ -1354,6 +1357,8 @@ impl<T> [T] {
1354
1357
/// dst.clone_from_slice(&src);
1355
1358
/// assert!(dst == [1, 2, 3]);
1356
1359
/// ```
1360
+ ///
1361
+ /// [`copy_from_slice`]: #method.copy_from_slice
1357
1362
#[ stable( feature = "clone_from_slice" , since = "1.7.0" ) ]
1358
1363
pub fn clone_from_slice ( & mut self , src : & [ T ] ) where T : Clone {
1359
1364
core_slice:: SliceExt :: clone_from_slice ( self , src)
@@ -1363,6 +1368,8 @@ impl<T> [T] {
1363
1368
///
1364
1369
/// The length of `src` must be the same as `self`.
1365
1370
///
1371
+ /// If `src` does not implement `Copy`, use [`clone_from_slice`].
1372
+ ///
1366
1373
/// # Panics
1367
1374
///
1368
1375
/// This function will panic if the two slices have different lengths.
@@ -1376,6 +1383,8 @@ impl<T> [T] {
1376
1383
/// dst.copy_from_slice(&src);
1377
1384
/// assert_eq!(src, dst);
1378
1385
/// ```
1386
+ ///
1387
+ /// [`clone_from_slice`]: #method.clone_from_slice
1379
1388
#[ stable( feature = "copy_from_slice" , since = "1.9.0" ) ]
1380
1389
pub fn copy_from_slice ( & mut self , src : & [ T ] ) where T : Copy {
1381
1390
core_slice:: SliceExt :: copy_from_slice ( self , src)
0 commit comments