-
Notifications
You must be signed in to change notification settings - Fork 63
/
Cargo.toml
241 lines (212 loc) · 9.1 KB
/
Cargo.toml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
lints.workspace = true
[package]
authors = [
"Jonas Bushart",
# For creation of the SerializeAs and DeserializeAs traits.
"Marcin Kaźmierczak",
]
name = "serde_with"
categories = ["encoding", "no-std", "no-std::no-alloc"]
description = "Custom de/serialization functions for Rust's serde"
documentation = "https://docs.rs/serde_with/"
keywords = ["serde", "utilities", "serialization", "deserialization"]
edition.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true
include = ["src/**/*", "tests/**/*", "LICENSE-*", "README.md", "CHANGELOG.md"]
[badges]
maintenance = {status = "actively-developed"}
# When adding new features update the documentation in feature-flags.md
# The features are documented using https://docs.rs/document-features
# lib.rs has support for generating the documentation from the feature flags.
# https://users.rust-lang.org/t/new-features-on-lib-rs/98560
[features]
default = ["std", "macros"]
#! `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.
## Enable support for types from the `alloc` crate when running in a `no_std` environment.
alloc = ["serde/alloc", "base64?/alloc", "chrono_0_4?/alloc", "hex?/alloc", "serde_json?/alloc", "time_0_3?/alloc"]
## 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`.
std = ["alloc", "serde/std", "chrono_0_4?/clock", "chrono_0_4?/std", "indexmap_1?/std", "indexmap_2?/std", "time_0_3?/serde-well-known", "time_0_3?/std"]
#! # Documentation
#!
#! The following features enhance the documentation of `serde_with`.
## The `guide` feature enables inclusion of this user guide.
## The feature only changes the rustdoc output and enables no other effects.
guide = ["dep:doc-comment", "dep:document-features", "macros", "std"]
#! # 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.
## The feature enables serializing data in base64 format.
base64 = ["dep:base64", "alloc"]
## Deprecated feature name. Use `chrono_0_4` instead.
chrono = ["chrono_0_4"]
## The feature enables integration of `chrono` v0.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 compatibility.
##
## This pulls in `chrono` v0.4 as a dependency.
chrono_0_4 = ["dep:chrono_0_4"]
## The feature enables `hashbrown::{HashMap, HashSet}` as supported containers.
##
## This pulls in `hashbrown` v0.14 as a dependency.
## It enables the `alloc` feature.
## Some functionality is only available when `std` is enabled too.
hashbrown_0_14 = ["dep:hashbrown_0_14", "alloc"]
## The feature enables serializing data in hex format.
##
## This pulls in `hex` as a dependency.
## It enables the `alloc` feature.
hex = ["dep:hex", "alloc"]
## Deprecated feature name. Use `indexmap_1` instead.
indexmap = ["indexmap_1"]
## The feature enables implementations of `indexmap` v1 specific checks.
## This includes support for checking duplicate keys and duplicate values.
## The legacy feature name `indexmap` is still available for v1 compatibility.
##
## This pulls in `indexmap` v1 as a dependency.
## It enables the `alloc` feature.
## Some functionality is only available when `std` is enabled too.
indexmap_1 = ["dep:indexmap_1", "alloc"]
## The feature enables implementations of `indexmap` v2 specific checks.
## This includes support for checking duplicate keys and duplicate values.
##
## This pulls in `indexmap` v2 as a dependency.
## It enables the `alloc` feature.
## Some functionality is only available when `std` is enabled too.
indexmap_2 = ["dep:indexmap_2", "alloc"]
## The feature enables JSON conversions from the `json` module.
##
## This pulls in `serde_json` as a dependency.
## It enables the `alloc` feature.
json = ["dep:serde_json", "alloc"]
## The feature 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.
macros = ["dep:serde_with_macros"]
## This feature enables integration with `schemars` 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
## the `std` feature as `schemars` is not `#[no_std]`.
schemars_0_8 = ["dep:schemars_0_8", "std", "serde_with_macros?/schemars_0_8"]
## The feature 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.
time_0_3 = ["dep:time_0_3"]
# When adding new optional dependencies, update the documentation in feature-flags.md
[dependencies]
base64 = {version = "0.22.0", optional = true, default-features = false}
chrono_0_4 = {package = "chrono", version = "0.4.20", optional = true, default-features = false, features = ["serde"]}
doc-comment = {version = "0.3.3", optional = true}
document-features = {version = "0.2.7", optional = true}
hashbrown_0_14 = {package = "hashbrown", version = "0.14.0", optional = true, default-features = false, features = ["serde"]}
hex = {version = "0.4.3", optional = true, default-features = false}
indexmap_1 = {package = "indexmap", version = "1.8", optional = true, default-features = false, features = ["serde-1"]}
indexmap_2 = {package = "indexmap", version = "2.0", optional = true, default-features = false, features = ["serde"]}
schemars_0_8 = {package = "schemars", version = "0.8.16", optional = true, default-features = false}
serde = {version = "1.0.152", default-features = false}
serde_derive = "1.0.152"
serde_json = {version = "1.0.45", optional = true, default-features = false}
serde_with_macros = {path = "../serde_with_macros", version = "=3.8.0", optional = true}
time_0_3 = {package = "time", version = "~0.3.11", optional = true, default-features = false}
[dev-dependencies]
expect-test = "1.5.0"
fnv = "1.0.6"
glob = "0.3.0"
jsonschema = { version = "0.17.1", default-features = false, features = ["resolve-file"] }
mime = "0.3.16"
pretty_assertions = "1.4.0"
regex = {version = "1.10.3", default-features = false, features = ["std"]}
rmp-serde = "1.1.0"
ron = "0.8"
rustversion = "1.0.0"
schemars_0_8 = {package = "schemars", version = "0.8.16"}
serde = {version = "1.0.152", default-features = false, features = ["derive"]}
serde_json = {version = "1.0.25", features = ["preserve_order"]}
serde_test = "1.0.124"
serde_yaml = "0.9.2"
serde-xml-rs = "0.6.0"
version-sync = "0.9.1"
[[test]]
name = "base64"
path = "tests/base64.rs"
required-features = ["base64", "macros"]
[[test]]
name = "chrono_0_4"
path = "tests/chrono_0_4.rs"
required-features = ["chrono_0_4", "macros"]
[[test]]
name = "hex"
path = "tests/hex.rs"
required-features = ["hex", "macros"]
[[test]]
name = "hashbrown_0_14"
path = "tests/hashbrown_0_14.rs"
required-features = ["hashbrown_0_14", "macros"]
[[test]]
name = "indexmap_1"
path = "tests/indexmap_1.rs"
required-features = ["indexmap_1", "macros"]
[[test]]
name = "indexmap_2"
path = "tests/indexmap_2.rs"
required-features = ["indexmap_2", "macros"]
[[test]]
name = "json"
path = "tests/json.rs"
required-features = ["json", "macros"]
[[test]]
name = "serde_as"
path = "tests/serde_as/lib.rs"
required-features = ["macros"]
[[test]]
name = "time_0_3"
path = "tests/time_0_3.rs"
required-features = ["macros", "time_0_3"]
[[test]]
name = "derives"
path = "tests/derives/lib.rs"
required-features = ["macros"]
[[test]]
name = "with_prefix"
path = "tests/with_prefix.rs"
required-features = ["macros"]
[[test]]
name = "rust"
path = "tests/rust.rs"
required-features = ["alloc"]
[[test]]
name = "schemars_0_8"
path = "tests/schemars_0_8.rs"
required-features = ["schemars_0_8"]
[package.metadata.docs.rs]
all-features = true
rustdoc-args = [
# Enable doc_cfg showing the required features.
"--cfg=docsrs",
# Generate links to definition in rustdoc source code pages
# https://github.com/rust-lang/rust/pull/84176
"-Zunstable-options", "--generate-link-to-definition"
]
[package.metadata.release]
pre-release-replacements = [
{file = "CHANGELOG.md", search = "\\[Unreleased\\]", replace = "[Unreleased]\n\n## [{{version}}] - {{date}}"},
{file = "src/lib.rs", search = "https://docs\\.rs/serde_with/[\\d.]+/", replace = "https://docs.rs/serde_with/{{version}}/"},
{file = "README.md", search = "https://docs\\.rs/serde_with/[\\d.]+/", replace = "https://docs.rs/serde_with/{{version}}/"},
]
tag = true
tag-message = "{{crate_name}} v{{version}}"
tag-name = "v{{version}}"