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
use Arc;
use CallbackHandle;
/// Rebuilds shared callback ownership from a raw [`CallbackHandle`].
///
/// Generated bindings use this trait for callback wrappers that are held behind
/// `Arc` and may be cloned across the boundary.
///
/// # Safety
///
/// `handle` must come from the matching generated foreign callback type. Passing
/// a handle created for a different callback wrapper, or reusing a handle after
/// its ownership was already consumed, is undefined behavior.
/// Rebuilds unique callback ownership from a raw [`CallbackHandle`].
///
/// Generated bindings use this trait for callback wrappers that are moved
/// across the boundary and later recovered as `Box<Self>`.
///
/// # Safety
///
/// `handle` must come from the matching generated foreign callback type and
/// must still represent a live boxed value. Calling this more than once for the
/// same owned handle is undefined behavior.