PutAt

Trait PutAt 

Source
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§

Source

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.

Source

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.

Implementors§

Source§

impl<'a, T: 'a> PutAt<T> for WriteOnlySlice<'a, T>