Damir Jelić ccd3b81557
Use web-time to return a SystemTime that works under WASM
The `MilliSecondsSinceUnixEpoch::to_system_time()` method returns the
`SystemTime` type from the standard library.

The `std::time::SystemTime::elapsed()` method sadly panics under WASM.
Instead of returning the `SystemTime` from the standard library we're
now returning a drop-in replacement of this type coming from the web-time
crate.
2024-03-20 12:19:18 +01:00

91 lines
2.9 KiB
TOML

[package]
name = "ruma-common"
version = "0.12.1"
description = "Common types for other ruma crates."
homepage = "https://ruma.io/"
keywords = ["matrix", "chat", "messaging", "ruma"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/ruma/ruma"
edition = "2021"
rust-version = { workspace = true }
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[features]
# These feature gates exist only for the tests. Disabling them results in a
# compile error.
default = ["client", "server"]
client = []
server = []
api = ["dep:http", "dep:konst"]
canonical-json = []
js = ["dep:js-sys", "getrandom?/js", "uuid?/js"]
rand = ["dep:rand", "dep:uuid"]
unstable-exhaustive-types = []
unstable-msc2870 = []
unstable-msc3930 = []
unstable-msc3931 = []
unstable-msc3932 = ["unstable-msc3931"]
unstable-unspecified = []
# Allow IDs to exceed 255 bytes.
compat-arbitrary-length-ids = ["ruma-identifiers-validation/compat-arbitrary-length-ids"]
# Don't validate the version part in `KeyId`.
compat-key-id = ["ruma-identifiers-validation/compat-key-id"]
# Allow some user IDs that are invalid even with the specified historical
# user ID scheme.
compat-user-id = ["ruma-identifiers-validation/compat-user-id"]
# Allow some mandatory fields to be missing, defaulting them to an empty string
# in deserialization.
compat-empty-string-null = []
# Allow certain fields to be `null` for compatibility, treating that the same as
# the field being absent.
compat-null = []
# Allow certain fields to be absent even though the spec marks them as
# mandatory. Deserialization will yield a default value like an empty string.
compat-optional = []
[dependencies]
as_variant = { workspace = true }
base64 = { workspace = true }
bytes = "1.0.1"
form_urlencoded = "1.0.0"
getrandom = { version = "0.2.6", optional = true }
http = { workspace = true, optional = true }
indexmap = { version = "2.0.0", features = ["serde"] }
js_int = { workspace = true, features = ["serde"] }
konst = { version = "0.3.5", default-features = false, features = ["cmp", "iter", "parsing"], optional = true }
percent-encoding = "2.1.0"
rand = { version = "0.8.3", optional = true }
regex = { version = "1.5.6", default-features = false, features = ["std", "perf"] }
ruma-identifiers-validation = { workspace = true }
ruma-macros = { workspace = true }
serde = { workspace = true }
serde_html_form = { workspace = true }
serde_json = { workspace = true, features = ["raw_value"] }
thiserror = { workspace = true }
time = "0.3.34"
tracing = { workspace = true, features = ["attributes"] }
url = "2.2.2"
uuid = { version = "1.0.0", optional = true, features = ["v4"] }
web-time = "1.1.0"
wildmatch = "2.0.0"
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
js-sys = { version = "0.3", optional = true }
[dev-dependencies]
assert_matches2 = { workspace = true }
assign = { workspace = true }
maplit = { workspace = true }
trybuild = "1.0.71"