1[package]
2autobenches = false
3categories = ["api-bindings", "date-and-time", "wasm"]
4description = "Drop-in replacement for std::time for Wasm in browsers"
5edition = "2021"
6include = ["CHANGELOG.md", "LICENSE-*", "src/**/*"]
7keywords = ["instant", "wasm", "web", "systemtime", "time"]
8license = "MIT OR Apache-2.0"
9name = "web-time"
10repository = "https://github.com/daxpedda/web-time"
11rust-version = "1.60"
12version = "1.1.0"
13
14[features]
15serde = ["dep:serde"]
16
17[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies]
18js-sys = "0.3.20"
19serde = { version = "1", optional = true }
20wasm-bindgen = { version = "0.2.70", default-features = false }
21
22[dev-dependencies]
23static_assertions = "1"
24
25[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
26pollster = { version = "0.3", features = ["macro"] }
27
28[target.'cfg(target_family = "wasm")'.dev-dependencies]
29getrandom = { version = "0.2", features = ["js"] }
30rand = "0.8"
31serde_json = "1"
32wasm-bindgen-futures = "0.4"
33wasm-bindgen-test = "0.3"
34web-sys = { version = "0.3", features = [
35 "CssStyleDeclaration",
36 "Document",
37 "Element",
38 "HtmlTableElement",
39 "HtmlTableRowElement",
40 "Performance",
41 "Window",
42] }
43
44[target.'cfg(all(target_family = "wasm", target_feature = "atomics"))'.dev-dependencies]
45futures-channel = { version = "0.3", default-features = false, features = ["alloc"] }
46futures-util = { version = "0.3", default-features = false }
47wasm-worker = { git = "https://github.com/daxpedda/wasm-worker", rev = "8b3e6324bdb5d44d5565b6981ce74ee773da9e3f" }
48web-sys = { version = "0.3", features = ["WorkerGlobalScope"] }
49
50[profile.bench]
51codegen-units = 1
52lto = true
53
54[[example]]
55name = "benchmark"
56path = "benches/benchmark.rs"
57
58[[test]]
59name = "serde"
60path = "tests/serde.rs"
61required-features = ["serde"]
62
63[package.metadata.docs.rs]
64all-features = true
65rustdoc-args = ["--cfg=docsrs"]
66targets = ["wasm32-unknown-unknown"]
67
68[lints.rust]
69# Rust groups.
70future_incompatible = { level = "warn", priority = -1 }
71rust_2018_compatibility = { level = "warn", priority = -1 }
72rust_2018_idioms = { level = "warn", priority = -1 }
73rust_2021_compatibility = { level = "warn", priority = -1 }
74unused = { level = "warn", priority = -1 }
75# Rust lints.
76deprecated_in_future = "warn"
77ffi_unwind_calls = "warn"
78macro_use_extern_crate = "warn"
79meta_variable_misuse = "warn"
80missing_abi = "warn"
81missing_copy_implementations = "warn"
82missing_debug_implementations = "warn"
83missing_docs = "warn"
84non_ascii_idents = "warn"
85single_use_lifetimes = "warn"
86trivial_casts = "warn"
87trivial_numeric_casts = "warn"
88unreachable_pub = "warn"
89unsafe_code = "deny"
90unsafe_op_in_unsafe_fn = "warn"
91unused_import_braces = "warn"
92unused_lifetimes = "warn"
93unused_qualifications = "warn"
94
95[lints.clippy]
96# Clippy groups.
97cargo = { level = "warn", priority = -1 }
98nursery = { level = "warn", priority = -1 }
99pedantic = { level = "warn", priority = -1 }
100# Clippy restriction lints.
101absolute_paths = "warn"
102allow_attributes = "warn"
103allow_attributes_without_reason = "warn"
104as_conversions = "warn"
105assertions_on_result_states = "warn"
106clone_on_ref_ptr = "warn"
107create_dir = "warn"
108dbg_macro = "warn"
109decimal_literal_representation = "warn"
110default_union_representation = "warn"
111empty_drop = "warn"
112empty_structs_with_brackets = "warn"
113error_impl_error = "warn"
114exit = "warn"
115filetype_is_file = "warn"
116float_cmp_const = "warn"
117fn_to_numeric_cast_any = "warn"
118format_push_string = "warn"
119get_unwrap = "warn"
120if_then_some_else_none = "warn"
121impl_trait_in_params = "warn"
122indexing_slicing = "warn"
123infinite_loop = "warn"
124large_include_file = "warn"
125lossy_float_literal = "warn"
126min_ident_chars = "warn"
127missing_assert_message = "warn"
128missing_asserts_for_indexing = "warn"
129missing_docs_in_private_items = "warn"
130mixed_read_write_in_expression = "warn"
131mutex_atomic = "warn"
132non_ascii_literal = "warn"
133partial_pub_fields = "warn"
134print_stderr = "warn"
135print_stdout = "warn"
136pub_without_shorthand = "warn"
137rc_buffer = "warn"
138rc_mutex = "warn"
139redundant_type_annotations = "warn"
140ref_patterns = "warn"
141rest_pat_in_fully_bound_structs = "warn"
142same_name_method = "warn"
143self_named_module_files = "warn"
144semicolon_outside_block = "warn"
145single_char_lifetime_names = "warn"
146str_to_string = "warn"
147string_add = "warn"
148string_lit_chars_any = "warn"
149string_slice = "warn"
150string_to_string = "warn"
151suspicious_xor_used_as_pow = "warn"
152todo = "warn"
153try_err = "warn"
154undocumented_unsafe_blocks = "warn"
155unimplemented = "warn"
156unnecessary_safety_doc = "warn"
157unnecessary_self_imports = "warn"
158unneeded_field_pattern = "warn"
159unseparated_literal_suffix = "warn"
160unwrap_used = "warn"
161use_debug = "warn"
162verbose_file_reads = "warn"
163# Allowed Clippy lints.
164equatable_if_let = "allow"
165explicit_deref_methods = "allow"
166future_not_send = "allow"
167module_inception = "allow"
168module_name_repetitions = "allow"
169option_if_let_else = "allow"
170redundant_pub_crate = "allow"
171tabs_in_doc_comments = "allow"
172
173[lints.rustdoc]
174all = { level = "warn", priority = -1 }
175