/// Extend a buffer to `size` bytes, initializing the new storage
/// to 0s. `size` is rounded up to the alignment. Returns false if
/// the allocation failed.
Extend a buffer to `size` bytes, initializing the new storage
to 0s. `size` is rounded up to the alignment. Returns false if
the allocation failed.
Extend a buffer to ` size ` bytes initializing the new storage to 0s . ` size ` is rounded up to the alignment . Returns false if the allocation failed .
pub fn extend(&mut self, size: usize) -> bool {
        let origsz = self.len;
        unsafe {
            let ok = self.extend_uninit(size);
            if ok && self.len > origsz {
                ptr::write_bytes((self.buf as usize + origsz) as *mut u8, 0, self.len - origsz);
                self.valid = self.len
            };
            ok
        }
    }
pub fn extend ( & mut self , size : usize ) -> bool { let origsz = self . len ; unsafe { let ok = self . extend_uninit ( size ) ; if ok && self . len > origsz { ptr :: write_bytes ( ( self . buf as usize + origsz ) as * mut u8 , 0 , self . len - origsz ) ; self . valid = self . len } ; ok } }
Extend a buffer to `size` bytes, initializing the new storage
to 0s.
Extend a buffer to ` size ` bytes initializing the new storage to 0s .
&mut self
size
usize