MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / from_slice

Method from_slice

src/backend/libc/pipe/types.rs:82–90  ·  view source on GitHub ↗

Creates a new `IoSlice` wrapping a byte slice.

(buf: &'a [u8])

Source from the content-addressed store, hash-verified

80impl<'a> IoSliceRaw<'a> {
81 /// Creates a new `IoSlice` wrapping a byte slice.
82 pub fn from_slice(buf: &'a [u8]) -> Self {
83 IoSliceRaw {
84 _buf: c::iovec {
85 iov_base: (buf.as_ptr() as *mut u8).cast::<c::c_void>(),
86 iov_len: buf.len() as _,
87 },
88 _lifetime: PhantomData,
89 }
90 }
91
92 /// Creates a new `IoSlice` wrapping a mutable byte slice.
93 pub fn from_slice_mut(buf: &'a mut [u8]) -> Self {

Callers

nothing calls this directly

Calls 2

as_ptrMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected