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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use ;
/// Wrapper for running a C-defined finalizer over foreign data upon [`Drop`].
///
/// # Safety
///
/// The [`Send`] and [`Sync`] implementations for this type are only safe if
/// the C caller ensures the following invariants:
///
/// - The `data` pointer must remain valid for the lifetime of this value and
/// must be safe to access from any thread.
/// - The `finalizer` function (if provided) must be safe to call from any
/// thread when this value is dropped.
/// - The data pointed to by `data` must not be concurrently mutated without
/// proper synchronization on the C side.
// SAFETY: The C caller is responsible for ensuring that `data` and
// `finalizer` are safe to send across thread boundaries and access
// from multiple threads. See the struct-level safety documentation.
unsafe
unsafe
/// Convenience method for creating a shared Rust slice from C inputs.
///
/// # Note
///
/// Returns an empty Rust slice if `len` is 0 disregarding `ptr`.
pub unsafe
/// Initialize a `MaybeUninit<T>` with `value`.
///
/// # ToDo
///
/// Replace calls to this function with [`MaybeUninit::write`] once it is stable.
///
/// [`MaybeUninit::write`]: https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#method.write
pub