pub trait WriteAt<T> {
// Required methods
fn write_at(&mut self, index: usize, value: T);
unsafe fn write_at_unchecked(&mut self, index: usize, value: T);
}
Expand description
A trait for objects which provide non-dropping indexed write access to their values.
Required Methods§
Sourcefn write_at(&mut self, index: usize, value: T)
fn write_at(&mut self, index: usize, value: T)
Performs a write of a memory location with the given value without reading or dropping the old value.
§Panics
Panics if index
is out of bounds.
Sourceunsafe fn write_at_unchecked(&mut self, index: usize, value: T)
unsafe fn write_at_unchecked(&mut self, index: usize, value: T)
Performs a write of a memory location with the given value without reading or dropping the old value.
For a safe alternative see WriteAt::write_at
.
§Safety
Calling this method with an out-of-bounds index is undefined behavior.