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
//! Enum columns, modeled by [`ActiveEnum`].
//!
//! SQLite has no enum type, so an enum column is stored as the text or
//! integer each variant maps to. The trait records that mapping once, and
//! the `DeriveActiveEnum` macro implements it together with the three
//! conversions a column type needs — `Into<Value>` for binding,
//! `FromValue` for decoding and `TursoType` for the DDL — so that an enum
//! can be used as a model field, in a condition and in an active model
//! exactly like a primitive.
//!
//! The backing type is left to the enum: `String` keeps the database
//! readable, an integer keeps it compact and sortable.
use FromValue;
use ;
use crateResult;
/// A Rust enum stored as one of its variants' values.
///
/// Derived by `DeriveActiveEnum`; implementing it by hand also works for an
/// enum that needs a custom mapping.