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
16
17
18
use bytes::Bytes;

use crate::SharedBuffer;

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