summaryrefslogtreecommitdiffstats
path: root/third_party/rust/serde_with/src/guide/feature_flags.md
blob: 39b6d4e72cba5da29a6f08e6b8f72d9551b0b286 (plain)
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
# Available Feature Flags

This crate has the following features which can be enabled.
Each entry will explain the feature in more detail.

`serde_with` is fully `no_std` compatible.
Using it in a `no_std` environment requires using `default-features = false`, since `std` is enabled by default.

1. [`alloc`](#alloc)
2. [`std` (default)](#std-default)
3. [`base64`](#base64)
4. [`chrono_0_4`](#chrono_0_4)
5. [`guide`](#guide)
6. [`hex`](#hex)
7. [`indexmap_1`](#indexmap_1)
8. [`json`](#json)
9. [`macros` (default)](#macros-default)
10. [`time_0_3`](#time_0_3)

## `alloc`

Enable support for types from the `alloc` crate when running in a `no_std` environment.

## `std` (default)

Enables support for various types from the std library.
This will enable `std` support in all dependencies too.
The feature enabled by default and also enables `alloc`.

## `base64`

The `base64` feature enables serializing data in base64 format.

This pulls in `base64` as a dependency.
It enables the `alloc` feature.

## `chrono_0_4`

The `chrono_0_4` feature enables integration of `chrono_0_4` specific conversions.
This includes support for the timestamp and duration types.
More features are available in combination with `alloc` or `std`.
The legacy feature name `chrono` is still available for v1 compatability.

This pulls in `chrono` v0.4 as a dependency.

## `guide`

The `guide` feature enables inclusion of this user guide.
The feature only changes the rustdoc output and enables no other effects.

## `hex`

The `hex` feature enables serializing data in hex format.

This pulls in `hex` as a dependency.
It enables the `alloc` feature.

## `indexmap_1`

The `indexmap_1` feature enables implementations of `indexmap_1` specific checks.
This includes support for checking duplicate keys and duplicate values.
The legacy feature name `indexmap` is still available for v1 compatability.

This pulls in `indexmap` as a dependency.
It enables the `alloc` feature.
Some functionality is only available when `std` is enabled too.

## `json`

The `json` features enables JSON conversions from the `json` module.

This pulls in `serde_json` as a dependency.
It enables the `alloc` feature.

## `macros` (default)

The `macros` features enables all helper macros and derives.
It is enabled by default, since the macros provide a usability benefit, especially for `serde_as`.

This pulls in `serde_with_macros` as a dependency.

## `time_0_3`

The `time_0_3` enables integration of `time` v0.3 specific conversions.
This includes support for the timestamp and duration types.

This pulls in `time` v0.3 as a dependency.
Some functionality is only available when `alloc` or `std` is enabled too.