mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Add copy_within to IndexSlice
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::ops::{Index, IndexMut, RangeBounds};
|
||||
use std::slice::GetDisjointMutError::*;
|
||||
use std::slice::{self, SliceIndex};
|
||||
|
||||
@@ -104,6 +104,17 @@ pub fn swap(&mut self, a: I, b: I) {
|
||||
self.raw.swap(a.index(), b.index())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn copy_within(
|
||||
&mut self,
|
||||
src: impl IntoSliceIdx<I, [T], Output: RangeBounds<usize>>,
|
||||
dest: I,
|
||||
) where
|
||||
T: Copy,
|
||||
{
|
||||
self.raw.copy_within(src.into_slice_idx(), dest.index());
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get<R: IntoSliceIdx<I, [T]>>(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user