Auxiliary method to create a new Buffer
(
ptr: NonNull<u8>,
len: usize,
deallocation: Deallocation,
)
| 165 | |
| 166 | /// Auxiliary method to create a new Buffer |
| 167 | unsafe fn build_with_arguments( |
| 168 | ptr: NonNull<u8>, |
| 169 | len: usize, |
| 170 | deallocation: Deallocation, |
| 171 | ) -> Self { |
| 172 | let bytes = unsafe { Bytes::new(ptr, len, deallocation) }; |
| 173 | let ptr = bytes.as_ptr(); |
| 174 | Buffer { |
| 175 | ptr, |
| 176 | data: Arc::new(bytes), |
| 177 | length: len, |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | /// Returns the number of bytes in the buffer |
| 182 | #[inline] |