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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! Support the `query!` expansion resolves against.
//!
//! Hidden: not a stable API surface. Everything here exists so a generated
//! type can be written as a self-contained block that names only
//! `::surrealguard_rs::_rt::*`, and so the crate calling the macro needs no
//! dependency but `surrealguard-rs`.
pub use ;
/// Decoding one statement's result failed.
///
/// Carries the statement index so [`Query::decode`](crate::Query::decode) can
/// attribute the failure; the query text is attached there, since the generated
/// decode closure does not carry it.
/// What a generated decode closure returns.
pub type DecodeResult<T> = ;
/// Decodes the value at `statement` into `T`, consuming it out of `values`.
///
/// The generated closure calls this once per responding statement. Slots are
/// indexed by *top-level statement*, matching the SDK: a non-responding
/// statement (a bare `LET`, a `DEFINE`) still occupies one.
///
/// # Errors
///
/// Returns [`DecodeError`] if the slot is missing or its value does not match
/// `T`.
/// Reads field `name` out of `object` and decodes it into `T`.
///
/// Generated struct decoders call this per field. Two things it does that a
/// bare `T::from_value` would not:
///
/// - An **absent** field decodes as `Value::None`, so a `NONE`-valued column
/// the server omits still lands in an `Option<T>` as `None`.
/// - A **`NULL`** field decodes as `None` when `T` admits it. The SDK's
/// `Option<T>` accepts only `Value::None`, not `Value::Null`, so without this
/// a SurrealQL `NULL` in an `option<T>` column would be a runtime error.
///
/// The error names the field, which the SDK's bare "Expected string, got
/// record" does not.
///
/// # Errors
///
/// Returns [`Error`] if the field's value does not match `T`.
/// Pins a bound parameter's value to `T`, the Rust type the kind the analyzer
/// inferred for that parameter decodes into.
///
/// `Into<T>` rather than a bare `T` so the obvious literals work — `"ada"` for a
/// `string` parameter, `18` for an `int` — while an unrelated type is still a
/// type error at the call site. This is the only path by which a value reaches
/// a query, so there is no unchecked bind.
/// Rejects a value that is not an object, for a generated struct's decoder.
///
/// # Errors
///
/// Returns [`Error`] if `value` is not a [`Value::Object`].