pub fn push(&mut self, item: T) -> Result<(), BufferFullError> {
        let capacity = self.capacity();
        let buffer: &mut [T] = unsafe { self.buffer.as_mut() };

        if self.len < capacity {
            // NOTE(ptr::write) the memory slot that we are about to write to is uninitialized. We
            // use `ptr::write` to avoid running `T`'s destructor on the uninitialized memory
            unsafe { ptr::write(&mut buffer[self.len], item) }
            self.len += 1;
            Ok(())
        } else {
            Err(BufferFullError)
        }
    }
/// Appends an element to the back of the collection
///
/// Returns `BufferFullError` if the vector is full
Appends an element to the back of the collection
Returns `BufferFullError` if the vector is full
Appends an element to the back of the collection Returns ` BufferFullError ` if the vector is full
pub fn push(&mut self, item: T) -> Result<(), BufferFullError> {
        let capacity = self.capacity();
        let buffer: &mut [T] = unsafe { self.buffer.as_mut() };
        if self.len < capacity {
            // NOTE(ptr::write) the memory slot that we are about to write to is uninitialized. We
            // use `ptr::write` to avoid running `T`'s destructor on the uninitialized memory
            unsafe { ptr::write(&mut buffer[self.len], item) }
            self.len += 1;
            Ok(())
        } else {
            Err(BufferFullError)
        }
    }
pub fn push ( & mut self , item : T ) -> Result < ( ) , BufferFullError > { let capacity = self . capacity ( ) ; let buffer : & mut [ T ] = unsafe { self . buffer . as_mut ( ) } ; if self . len < capacity { // NOTE(ptr::write) the memory slot that we are about to write to is uninitialized. We // use `ptr::write` to avoid running `T`'s destructor on the uninitialized memory unsafe { ptr :: write ( & mut buffer [ self . len ] , item ) } self . len += 1 ; Ok ( ( ) ) } else { Err ( BufferFullError ) } }
Appends an element to the back of the collection
Returns `BufferFullError` if the vector is full
Appends an element to the back of the collection Returns ` BufferFullError ` if the vector is full
&mut self
item
T
&mut self
item
T