[−][src]Struct ioslice::IoBox
An owned chunk of memory, that is ABI-compatible with libc::iovec
. At the moment this
does not work on Windows.
This must be allocated via the system alloc; importing pointers from malloc(2) is currently not possible.
Implementations
impl<I: Initialization> IoBox<I>
[src]
pub fn try_alloc_zeroed(length: usize) -> Result<Self, AllocationError>
[src]
Attempt to allocate length
bytes, which are initially set to zero.
This allocation may fail, but should not be used unless the global allocator actually
does return null when there is no memory. This is generally not the case for userspace
processes, where the kernel gives more memory than physically available, but is
obviously useful in #![no_std]
.
Since the allocator may be able to already have zeroed blocks of memory, this should be
preferred over manually initializing it using zeroed
.
pub fn alloc_zeroed(length: usize) -> Self
[src]
Allocate length
bytes, which are initially set to zero.
Panics
This method will, like most other heap-allocated structures in the alloc
crate, panic
when there is no available memory left.
pub fn into_raw_parts(self) -> (*mut u8, usize)
[src]
Turn the I/O box into the underlying pointer and size.
pub unsafe fn from_raw_parts(base: *mut u8, len: usize) -> Self
[src]
Convert an underlying pointer and size, into an IoBox
.
Safety
For this to be safe, the validity and initialization invariants must be held. In addition to that, the pointer must be allocated using the system allocator.
pub fn into_iovec(self) -> iovec
[src]
pub fn into_box(self) -> Box<[u8]>
[src]
pub fn as_ioslice(&self) -> IoSlice<'_, I>
[src]
pub fn as_ioslice_mut(&mut self) -> IoSliceMut<'_, I>
[src]
pub fn inner_data(&self) -> &[I::DerefTargetItem]
[src]
pub fn inner_data_mut(&mut self) -> &mut [I::DerefTargetItem]
[src]
pub fn slice_as_ioslices(these: &[Self]) -> &[IoSlice<'_>]
[src]
pub fn slice_as_ioslices_mut(these: &mut [Self]) -> &mut [IoSlice<'_>]
[src]
pub fn slice_as_mut_ioslices(these: &[Self]) -> &[IoSliceMut<'_>]
[src]
pub fn slice_as_mut_ioslices_mut(these: &mut [Self]) -> &mut [IoSliceMut<'_>]
[src]
pub unsafe fn assume_init(self) -> IoBox<Initialized>
[src]
Convert IoBox<_>
into IoBox<Initialized>
, assuming that the data is initialized.
Safety
This shall not be used for initializing data. In that case, initialize it manually
via as_maybe_uninit_slice_mut
, and then call this.
While the validity invariant is already upheld when creating this type, the caller must
ensure that the data be initialized. Refer to the std::mem::MaybeUninit
docs.
pub fn as_maybe_uninit_slice(&self) -> &[MaybeUninit<u8>]
[src]
pub fn as_maybe_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<u8>]
[src]
pub fn zeroed(self) -> IoBox<Initialized>
[src]
pub fn try_alloc_uninit(
length: usize
) -> Result<IoBox<Uninitialized>, AllocationError>
[src]
length: usize
) -> Result<IoBox<Uninitialized>, AllocationError>
pub fn alloc_uninit(length: usize) -> IoBox<Uninitialized>
[src]
impl IoBox<Initialized>
[src]
Trait Implementations
impl AsMut<[u8]> for IoBox
[src]
impl AsRef<[u8]> for IoBox
[src]
impl Borrow<[u8]> for IoBox
[src]
impl BorrowMut<[u8]> for IoBox
[src]
fn borrow_mut(&mut self) -> &mut [u8]
[src]
impl Debug for IoBox
[src]
impl Deref for IoBox
[src]
impl DerefMut for IoBox
[src]
impl<I: Initialization> Drop for IoBox<I>
[src]
impl Eq for IoBox
[src]
impl From<Box<[u8]>> for IoBox
[src]
impl From<IoBox<Initialized>> for Box<[u8]>
[src]
impl From<IoBox<Initialized>> for Vec<u8>
[src]
impl From<Vec<u8>> for IoBox
[src]
impl PartialEq<[u8]> for IoBox
[src]
impl PartialEq<IoBox<Initialized>> for IoBox
[src]
impl<'a> PartialEq<IoSlice<'a, Initialized>> for IoBox
[src]
fn eq(&self, other: &IoSlice<'_>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialEq<IoSliceMut<'a, Initialized>> for IoBox
[src]
Auto Trait Implementations
impl<I> RefUnwindSafe for IoBox<I> where
I: RefUnwindSafe,
I: RefUnwindSafe,
impl<I = Initialized> !Send for IoBox<I>
impl<I = Initialized> !Sync for IoBox<I>
impl<I> Unpin for IoBox<I> where
I: Unpin,
I: Unpin,
impl<I> UnwindSafe for IoBox<I> where
I: UnwindSafe,
I: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,