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
use crateValue;
/// Creates a heap-allocated `Value` from a Rust boolean.
///
/// # Parameters
/// - `val`: Rust `bool` to convert into a `Value`.
///
/// # Returns
/// - Pointer to a heap-allocated `Value` representing the boolean.
/// - Returns `null` if conversion fails.
///
/// # Safety
/// - The returned pointer must eventually be freed with `value_free` to avoid memory leaks.
pub extern "C"
/// Extracts a Rust boolean from a `Value`.
///
/// # Parameters
/// - `value`: Pointer to a `Value` to read from.
/// - `out`: Pointer to a `bool` where the result will be written.
///
/// # Returns
/// - `true` if the conversion succeeded.
/// - `false` if the pointer is null or the `Value` is not a boolean.
///
/// # Safety
/// - `value` and `out` must be valid pointers.
/// - Writing to `out` assumes the caller provides valid memory.
pub extern "C"