ps_buffer/methods/
alloc_uninit.rs

1use crate::{Buffer, BufferError};
2
3impl Buffer {
4    #[inline]
5    /// Allocates a `Buffer` and does not initialize its content.
6    /// # Errors
7    /// `AllocationError` is returned if allocation fails.
8    pub fn alloc_uninit(length: usize) -> Result<Self, BufferError> {
9        let mut buffer = Self::with_capacity(length)?;
10
11        buffer.set_len(length)?;
12
13        Ok(buffer)
14    }
15}