Trait write_only::PutAt [−][src]
pub trait PutAt<T> {
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
Puts the value at index
to the given value, dropping the old value.
Panics
Panics if index
is out of bounds.
unsafe 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.