pub struct RawBuf { /* private fields */ }
Expand description
RawBuf is not a real buf. It only hold the pointer of the buffer. Users must make sure the buffer behind the pointer is always valid. Which means, user must:
- await the future with RawBuf Ready before drop the real buffer
- make sure the pointer and length is valid before the future Ready
Implementations§
Source§impl RawBuf
impl RawBuf
Sourcepub unsafe fn new_from_iovec_mut<T: IoVecBufMut>(data: &mut T) -> Option<Self>
pub unsafe fn new_from_iovec_mut<T: IoVecBufMut>(data: &mut T) -> Option<Self>
Create a new RawBuf with the first iovec part.
§Safety
make sure the pointer and length is valid when RawBuf is used.
Trait Implementations§
Source§impl IoBuf for RawBuf
impl IoBuf for RawBuf
Source§fn bytes_init(&self) -> usize
fn bytes_init(&self) -> usize
Number of initialized bytes. Read more
Source§fn slice(self, range: impl RangeBounds<usize>) -> Slice<Self>where
Self: Sized,
fn slice(self, range: impl RangeBounds<usize>) -> Slice<Self>where
Self: Sized,
Returns a view of the buffer with the specified range.
Source§unsafe fn slice_unchecked(self, range: impl RangeBounds<usize>) -> Slice<Self>where
Self: Sized,
unsafe fn slice_unchecked(self, range: impl RangeBounds<usize>) -> Slice<Self>where
Self: Sized,
Returns a view of the buffer with the specified range without boundary
checking. Read more
Source§impl IoBufMut for RawBuf
impl IoBufMut for RawBuf
Source§fn write_ptr(&mut self) -> *mut u8
fn write_ptr(&mut self) -> *mut u8
Returns a raw mutable pointer to the vector’s buffer. Read more
Source§fn bytes_total(&mut self) -> usize
fn bytes_total(&mut self) -> usize
Total size of the buffer, including uninitialized memory, if any. Read more
Source§fn slice_mut(self, range: impl RangeBounds<usize>) -> SliceMut<Self>
fn slice_mut(self, range: impl RangeBounds<usize>) -> SliceMut<Self>
Returns a view of the buffer with the specified range. Read more
Source§unsafe fn slice_mut_unchecked(
self,
range: impl RangeBounds<usize>,
) -> SliceMut<Self>where
Self: Sized,
unsafe fn slice_mut_unchecked(
self,
range: impl RangeBounds<usize>,
) -> SliceMut<Self>where
Self: Sized,
Returns a view of the buffer with the specified range. Read more
Auto Trait Implementations§
impl Freeze for RawBuf
impl RefUnwindSafe for RawBuf
impl !Send for RawBuf
impl !Sync for RawBuf
impl Unpin for RawBuf
impl UnwindSafe for RawBuf
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more