1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/// Build a `&[u8]` from a C caller's `(ptr, len)` pair. `ptr == null`
/// with any `len` is treated as empty.
///
/// # Safety
///
/// If `ptr` is non-null, the caller must guarantee the invariants of
/// [`core::slice::from_raw_parts`]: `ptr` is valid for reads of
/// `len * size_of::<u8>()` bytes and properly aligned, the memory is
/// not mutated for the returned lifetime, and `len` fits in `isize`.
pub unsafe
/// Build a `&mut [u8]` from a C caller's `(ptr, len)` pair. `ptr == null`
/// with any `len` is treated as empty.
///
/// # Safety
///
/// If `ptr` is non-null, the caller must guarantee the invariants of
/// [`core::slice::from_raw_parts_mut`]: `ptr` is valid for reads and
/// writes of `len * size_of::<u8>()` bytes, properly aligned, no other
/// reference aliases the region for the returned lifetime, and `len`
/// fits in `isize`.
pub unsafe