Skip to content

Commit f5ea6ed

Browse files
authored
feat: add serde feature for web_time::SystemTime (#17)
## Description Makes the `SystemTime` version for Wasm compatible with serde. ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
1 parent 0704b54 commit f5ea6ed

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

Cargo.lock

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ["cfg(n0_future_docsrs)"] }
6262

6363
[lints.clippy]
6464
unused-async = "warn"
65+
66+
[features]
67+
serde = ["web-time/serde"]

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ We do this in a couple of ways:
2929

3030
It's entirely possible that we'll expand the scope of this library, that currently is mostly a re-exports crate to a crate that provides our own flavor of async APIs that we deem are safer to use, we write about some of these ideas in this issue: https://github.com/n0-computer/iroh/issues/2979
3131

32+
## Feature flags
33+
34+
* `serde`: Enables serde support for the [`time::SystemTime`] type when building for WebAssembly.
35+
3236
## Note to Maintainers: Creating a release
3337

3438
- Make sure to have `git-cliff`, `cargo-release` and `cargo-semver-checks` installed.

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
//! This library also allows importing a single [`task`] and [`time`] module that'll work
66
//! in `wasm*-*-unknown` targets, using `wasm_bindgen` and `wasm_bindgen_futures`, but mirroring
77
//! the `tokio` API with only minor differences.
8+
//!
9+
//! ## Feature flags
10+
//!
11+
//! * `serde`: Enables serde support for the [`time::SystemTime`] type when building for WebAssembly.
812
913
#![deny(missing_docs, rustdoc::broken_intra_doc_links)]
1014
#![cfg_attr(not(test), deny(clippy::unwrap_used))]

0 commit comments

Comments
 (0)