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
use crateValue;
/// Creates a heap-allocated [`Value`] from a Rust boolean.
///
/// # Parameters
/// - `val`: Rust `bool` to wrap inside a [`Value`].
///
/// # Returns
/// - Pointer to a heap-allocated [`Value`] representing the boolean.
/// - Never returns null in normal operation (conversion cannot fail for bools).
///
/// # Safety
/// - The returned pointer must eventually be freed with `value_free` to avoid memory leaks.
/// - Pointer must not be dereferenced after being freed.
pub extern "C"
/// Extracts a Rust boolean from a heap-allocated [`Value`].
///
/// # Parameters
/// - `value`: Pointer to a [`Value`] expected to contain a boolean.
/// - `out`: Pointer to a `bool` where the result will be written.
///
/// # Returns
/// - `true` if extraction succeeded.
/// - `false` if `value` is null or does not contain a valid boolean.
///
/// # Safety
/// - Both `value` and `out` must be valid, non-null pointers.
/// - Caller must ensure that `out` points to a valid writable memory location.
pub extern "C"