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
//! The PHP value model: [`Value`], [`Str`], [`Array`], [`ArrayKey`].
//!
//! One model for every crate that carries PHP values (request payloads,
//! documents, cache entries, queue messages), with the engine's semantics:
//! byte strings, ordered arrays with integer and string keys, `stdClass`,
//! integers distinct from floats. The codecs ([`crate::json`],
//! [`crate::serialize`], [`crate::igbinary`]), type juggling and comparison
//! ([`Value::loose_eq`], [`Value::cmp_php`]) and sorting ([`crate::sort`])
//! work on it.
//!
//! | PHP | Rust |
//! |---|---|
//! | `null`, `bool`, `int`, `float` | [`Value::Null`], [`Value::Bool`], [`Value::Int`], [`Value::Float`] |
//! | `string` (bytes) | [`Value::Str`] / [`Str`] |
//! | `array` | [`Value::Array`] / [`Array`], keys [`ArrayKey`] |
//! | `stdClass` | [`Value::Object`] (its property table, string keys as given) |
//! | other objects (`Utopia\Database\Document`, ...) | [`Value::Ext`], an [`Extension`] |
//! | `ZEND_HANDLE_NUMERIC_STR` | [`ArrayKey::normalize`], [`numeric_key`] |
//! | `gettype`, `(bool)`, `(string)`, `(float)` | [`Value::type_name`], [`Value::truthy`], [`Value::to_php_string`], [`Value::to_double`] |
//! | `==`, `===`, `<=>` (`zend_compare`) | [`Value::loose_eq`], [`Value::strict_eq`], [`Value::cmp_php`], [`Value::compare`] |
//! | `Utopia\Http\Request` body decoding | [`Value::from_json`] |
//!
//! Values have no identity: PHP references and shared instances are copies
//! here. Two object values are never `===` (separately created PHP objects
//! are distinct instances), which is the one place where identity shows.
//!
//! Against the skeleton in rfc/rust-database.md: [`Array::iter`] yields
//! borrowed [`KeyRef`]s (a packed array stores no keys), and the engine's
//! packed-array bookkeeping is part of [`Array`] because it decides the next
//! free index (see its docs).
pub
use fmt;
pub use Builder;
pub use ;
pub use strStr;
pub use Value;
/// Objects of classes other than `stdClass` that a crate carries in
/// [`Value::Ext`] (for the database: `Document` and `Operator`).
/// No extension: plain PHP values.
/// An engine error thrown while juggling a value: `TypeError`, `ValueError`,
/// `JsonException`, or `Error` (an object that cannot become a string).