Add copy_within
to IndexSlice
This commit is contained in:
parent
40dacd50b7
commit
52694034ba
1 changed files with 12 additions and 1 deletions
|
@ -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 @@ impl<I: Idx, T> IndexSlice<I, T> {
|
|||
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue