pub struct RawIoBuf { /* private fields */ }Expand description
Raw I/O buffer (Non-owning, Copy) 原始 I/O 缓冲区(不持有所有权,可复制)
For Buffer Pool Arena mode. Implements Copy for ergonomic async IO.
用于 Buffer Pool Arena 模式,实现 Copy 便于异步 IO
Implementations§
Source§impl RawIoBuf
impl RawIoBuf
Sourcepub fn from_slice(slice: &mut [u8]) -> Self
pub fn from_slice(slice: &mut [u8]) -> Self
Create from mutable slice / 从可变切片创建
Sourcepub unsafe fn slice(self, offset: usize, len: usize) -> Self
pub unsafe fn slice(self, offset: usize, len: usize) -> Self
Slice for reading (len = 0, waiting for IO to fill) 切片用于读取(len = 0,等待 IO 填充)
§Safety
offset + lenmust not exceed capacityoffsetmust be aligned for Direct I/O
Sourcepub unsafe fn slice_data(self, offset: usize, len: usize) -> Self
pub unsafe fn slice_data(self, offset: usize, len: usize) -> Self
Slice for writing (len = cap, contains data) 切片用于写入(len = cap,包含待写数据)
§Safety
offset + lenmust not exceed capacityoffsetmust be aligned for Direct I/O
Sourcepub unsafe fn slice_unchecked(self, offset: usize, len: usize) -> Self
pub unsafe fn slice_unchecked(self, offset: usize, len: usize) -> Self
pub const fn len(&self) -> usize
pub const fn cap(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn as_ptr(&self) -> *const u8
pub const fn as_mut_ptr(&self) -> *mut u8
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Trait Implementations§
Source§impl IoBuf for RawIoBuf
impl IoBuf for RawIoBuf
Source§fn buf_capacity(&self) -> usize
fn buf_capacity(&self) -> usize
Total size of the buffer, including uninitialized memory, if any. 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. Read more
Source§impl IoBufMut for RawIoBuf
impl IoBufMut for RawIoBuf
Source§fn as_buf_mut_ptr(&mut self) -> *mut u8
fn as_buf_mut_ptr(&mut self) -> *mut u8
Returns a raw mutable pointer to the vector’s buffer. Read more
Source§fn as_mut_slice(&mut self) -> &mut [MaybeUninit<u8>]
fn as_mut_slice(&mut self) -> &mut [MaybeUninit<u8>]
Get the uninitialized part of the buffer.
Source§unsafe fn as_io_slice_mut(&mut self) -> IoSliceMut
unsafe fn as_io_slice_mut(&mut self) -> IoSliceMut
Create an
IoSliceMut of the uninitialized part of the buffer. Read moreSource§impl SetBufInit for RawIoBuf
impl SetBufInit for RawIoBuf
Source§unsafe fn set_buf_init(&mut self, len: usize)
unsafe fn set_buf_init(&mut self, len: usize)
Set the buffer length. If
len is less than the current length, nothing
should happen. Read moreimpl Copy for RawIoBuf
impl Send for RawIoBuf
impl Sync for RawIoBuf
Auto Trait Implementations§
impl Freeze for RawIoBuf
impl RefUnwindSafe for RawIoBuf
impl Unpin for RawIoBuf
impl UnwindSafe for RawIoBuf
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