ps-buffer 0.1.0-23

aligned heap buffer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use bytes::Bytes;

use crate::Buffer;

impl From<Buffer> for Bytes {
    /// Converts a [`Buffer`] into [`Bytes`] without copying its contents.
    ///
    /// The [`Buffer`] becomes the owner of the returned [`Bytes`], so its whole
    /// allocation, including any capacity beyond [`Buffer::len`], is retained
    /// until the last clone of the returned [`Bytes`] is dropped. Prefer
    /// [`Bytes::copy_from_slice`] if the unused capacity is substantial.
    fn from(value: Buffer) -> Self {
        Self::from_owner(value)
    }
}