Module serde_with::guide::feature_flags
source · Expand description
§Available Feature Flags
serde_with
is fully no_std
compatible, by depending on it with default-features = false
.
Support for alloc
and std
can be enabled with the respective features.
Some features require alloc
or std
support and might not work in a no_std
environment.
alloc
— Enable support for types from thealloc
crate when running in ano_std
environment.std
(enabled by default) — Enables support for various types from the std library. This will enablestd
support in all dependencies too. The feature enabled by default and also enablesalloc
.
§Documentation
The following features enhance the documentation of serde_with
.
guide
— Theguide
feature enables inclusion of this user guide. The feature only changes the rustdoc output and enables no other effects.
§Features
The following features enable support for types from other crates or enable additional functionality that requires further dependencies to be pulled in. These features are disabled by default to minimize the number of required dependencies.
-
base64
— The feature enables serializing data in base64 format. -
chrono
— Deprecated feature name. Usechrono_0_4
instead. -
chrono_0_4
— The feature enables integration ofchrono
v0.4 specific conversions. This includes support for the timestamp and duration types. More features are available in combination withalloc
orstd
. The legacy feature namechrono
is still available for v1 compatibility.This pulls in
chrono
v0.4 as a dependency. -
hashbrown_0_14
— The feature enableshashbrown::{HashMap, HashSet}
as supported containers.This pulls in
hashbrown
v0.14 as a dependency. It enables thealloc
feature. Some functionality is only available whenstd
is enabled too. -
hex
— The feature enables serializing data in hex format.This pulls in
hex
as a dependency. It enables thealloc
feature. -
indexmap
— Deprecated feature name. Useindexmap_1
instead. -
indexmap_1
— The feature enables implementations ofindexmap
v1 specific checks. This includes support for checking duplicate keys and duplicate values. The legacy feature nameindexmap
is still available for v1 compatibility.This pulls in
indexmap
v1 as a dependency. It enables thealloc
feature. Some functionality is only available whenstd
is enabled too. -
indexmap_2
— The feature enables implementations ofindexmap
v2 specific checks. This includes support for checking duplicate keys and duplicate values.This pulls in
indexmap
v2 as a dependency. It enables thealloc
feature. Some functionality is only available whenstd
is enabled too. -
json
— The feature enables JSON conversions from thejson
module.This pulls in
serde_json
as a dependency. It enables thealloc
feature. -
macros
(enabled by default) — The feature enables all helper macros and derives. It is enabled by default, since the macros provide a usability benefit, especially forserde_as
.This pulls in
serde_with_macros
as a dependency. -
schemars_0_8
— This feature enables integration withschemars
0.8. This makes#[derive(JsonSchema)]
pick up the correct schema for the type used within#[serde_as(as = ...)]
.This pulls in
schemars
v0.8 as a dependency. It will also implicitly enable thestd
feature asschemars
is not#[no_std]
. -
time_0_3
— The feature enables integration oftime
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 whenalloc
orstd
is enabled too.