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
//! Conversions between Rust and **SQLite** types.
//!
//! # Types
//!
//! | Rust type | SQLite type(s) |
//! |---------------------------------------|---------------------|
//! | `bool` | BOOLEAN |
//! | `i8` | INTEGER |
//! | `i16` | INTEGER |
//! | `i32` | INTEGER |
//! | `i64` | BIGINT, INT8 |
//! | `u8` | INTEGER |
//! | `u16` | INTEGER |
//! | `u32` | INTEGER |
//! | `f32` | REAL |
//! | `f64` | REAL |
//! | `&str`, [`String`] | TEXT |
//! | `&[u8]`, `Vec<u8>` | BLOB |
//! | `VecF32`* | BLOB |
//! | `VecInt8`* | BLOB |
//! | `VecBit`* | BLOB |
//! | `time::PrimitiveDateTime` | DATETIME |
//! | `time::OffsetDateTime` | DATETIME |
//! | `time::Date` | DATE |
//! | `time::Time` | TIME |
//! | `bstr::BString` | BLOB |
//!
//! `*` Requires the `vec` feature.
//!
//! #### Note: Unsigned Integers
//!
//! The unsigned integer types `u8`, `u16` and `u32` are implemented by zero-extending to the next-larger signed type.
//! So `u8` becomes `i16`, `u16` becomes `i32`, and `u32` becomes `i64` while still retaining their semantic values.
//!
//! SQLite stores integers in a variable-width encoding and always handles them in memory as 64-bit signed values, so no
//! space is wasted by this implicit widening.
//!
//! There is no corresponding larger type for `u64` in SQLite (it would require a `i128`), and so it is not supported.
//! Bit-casting it to `i64` or storing it as `REAL`, `BLOB` or `TEXT` would change the semantics of the value in SQL and
//! so violates the principle of least surprise.
//!
//! # Nullable
//!
//! `Option<T>` is supported where `T` implements `Encode` or `Decode`. An `Option<T>` represents a potentially `NULL`
//! value from SQLite.
/// Ensure a value is compatible with the expected SQLite type.
/// Conversions for `bstr` text types.
/// Conversions for `time` crate types.
/// Vector conversions for sqlite-vec (`feature = "vec"`).
/// Bool type conversions.
/// Byte slice conversions.
/// Floating-point conversions.
/// Integer conversions.
/// String conversions.
/// Unsigned integer conversions.