Skip to content

Commit 8fba3b9

Browse files
committed
Fix serde feature flag
1 parent 1260c46 commit 8fba3b9

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "http-cache-semantics"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
description = "RFC 7234. Parses HTTP headers to correctly compute cacheability of responses, even in complex cases"
55
homepage = "https://lib.rs/http-cache-semantics"
66
repository = "https://github.com/kornelski/rusty-http-cache-semantics"
@@ -17,9 +17,9 @@ rust-version = "1.64"
1717
[dependencies]
1818
http = "1.0.0"
1919
http-serde = { version = "2.0.0", optional = true }
20-
serde = { version = "1.0.192", optional = true, features = ["derive"] }
20+
serde = { version = "1.0.193", optional = true, features = ["derive"] }
2121
# reqwest = { version = "0.11.22", default-features = false, optional = true } # not upgraded yet
22-
time = { version = "0.3.30", features = ["parsing", "formatting"] }
22+
time = { version = "0.3.20", features = ["parsing", "formatting"] }
2323

2424
[dev-dependencies]
2525
serde_json = "1.0.108"

src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn format_cache_control(cc: &CacheControl) -> String {
109109

110110
/// Configuration options which control behavior of the cache. Use with `CachePolicy::new_options()`.
111111
#[derive(Debug, Copy, Clone)]
112-
#[cfg_attr(feature = "with_serde", derive(serde::Serialize, serde::Deserialize))]
112+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
113113
pub struct CacheOptions {
114114
/// If `true` (default), then the response is evaluated from a
115115
/// perspective of a shared cache (i.e. `private` is not cacheable and
@@ -152,17 +152,17 @@ impl Default for CacheOptions {
152152
/// tricky details such as the Vary header, proxy revalidation, and
153153
/// authenticated responses.
154154
#[derive(Debug, Clone)]
155-
#[cfg_attr(feature = "with_serde", derive(serde::Serialize, serde::Deserialize))]
155+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
156156
pub struct CachePolicy {
157-
#[cfg_attr(feature = "with_serde", serde(with = "http_serde::header_map"))]
157+
#[cfg_attr(feature = "serde", serde(with = "http_serde::header_map"))]
158158
req: HeaderMap,
159-
#[cfg_attr(feature = "with_serde", serde(with = "http_serde::header_map"))]
159+
#[cfg_attr(feature = "serde", serde(with = "http_serde::header_map"))]
160160
res: HeaderMap,
161-
#[cfg_attr(feature = "with_serde", serde(with = "http_serde::uri"))]
161+
#[cfg_attr(feature = "serde", serde(with = "http_serde::uri"))]
162162
uri: Uri,
163-
#[cfg_attr(feature = "with_serde", serde(with = "http_serde::status_code"))]
163+
#[cfg_attr(feature = "serde", serde(with = "http_serde::status_code"))]
164164
status: StatusCode,
165-
#[cfg_attr(feature = "with_serde", serde(with = "http_serde::method"))]
165+
#[cfg_attr(feature = "serde", serde(with = "http_serde::method"))]
166166
method: Method,
167167
opts: CacheOptions,
168168
res_cc: CacheControl,

tests/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ fn test_proxy_cacheable_auth_is_ok() {
451451
assert_eq!(policy.is_stale(now), false);
452452
assert!(policy.is_storable());
453453

454-
#[cfg(feature = "with_serde")]
454+
#[cfg(feature = "serde")]
455455
{
456456
let json = serde_json::to_string(&policy).unwrap();
457457
let policy: CachePolicy = serde_json::from_str(&json).unwrap();
@@ -575,7 +575,7 @@ fn test_weird_syntax() {
575575
assert_eq!(policy.is_stale(now), false);
576576
assert_eq!((policy.time_to_live(now) + policy.age(now)).as_secs(), 456);
577577

578-
#[cfg(feature = "with_serde")]
578+
#[cfg(feature = "serde")]
579579
{
580580
let json = serde_json::to_string(&policy).unwrap();
581581
let policy: CachePolicy = serde_json::from_str(&json).unwrap();

0 commit comments

Comments
 (0)