Trait write_only::WriteFromSliceAt [−][src]
pub trait WriteFromSliceAt<T>: WriteAt<T> {
fn write_cloning_from_slice_at(&mut self, src: &[T], offset: usize)
where
T: Clone;
fn write_copying_from_slice_at(&mut self, src: &[T], offset: usize)
where
T: Copy;
}
Expand description
A trait for objects which provide non-dropping indexed write access to their values from a slice.
Required methods
fn write_cloning_from_slice_at(&mut self, src: &[T], offset: usize) where
T: Clone,
fn write_cloning_from_slice_at(&mut self, src: &[T], offset: usize) where
T: Clone,
Copies the elements from src
into self
.
The length of src
must be less than self.len - offset
.
If T
implements Copy
, it can be more performant to use
WriteFromSliceAt::write_copying_from_slice_at
.
Panics
This function will panic if the length of src
is greater than self.len - offset
.
fn write_copying_from_slice_at(&mut self, src: &[T], offset: usize) where
T: Copy,
fn write_copying_from_slice_at(&mut self, src: &[T], offset: usize) where
T: Copy,
Copies all elements from src
into self
, using a memcpy.
The length of src
must be less than self.len - offset
.
If T
does not implement Copy
, use WriteFromSliceAt::write_cloning_from_slice_at
.
Panics
This function will panic if the length of src
is greater than self.len - offset
.