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