Add EventJson::into_json

This commit is contained in:
Jonas Platte 2020-05-09 15:41:34 +02:00
parent 4eb72e4cf0
commit 206a824f3e
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
4 changed files with 18 additions and 7 deletions

View File

@ -1,5 +1,11 @@
# [unreleased]
# 0.21.1
Improvements:
* Add `EventJson::into_json`
# 0.21.0
Breaking changes:

View File

@ -9,16 +9,16 @@ license = "MIT"
name = "ruma-events"
readme = "README.md"
repository = "https://github.com/ruma/ruma-events"
version = "0.21.0"
version = "0.21.1"
edition = "2018"
[dependencies]
js_int = { version = "0.1.5", features = ["serde"] }
ruma-common = "0.1.1"
ruma-events-macros = { path = "ruma-events-macros", version = "=0.21.0" }
ruma-events-macros = { path = "ruma-events-macros", version = "=0.21.1" }
ruma-identifiers = "0.16.1"
ruma-serde = "0.1.3"
serde = { version = "1.0.106", features = ["derive"] }
serde = { version = "1.0.107", features = ["derive"] }
serde_json = { version = "1.0.52", features = ["raw_value"] }
[dev-dependencies]

View File

@ -10,10 +10,10 @@ license = "MIT"
name = "ruma-events-macros"
readme = "README.md"
repository = "https://github.com/ruma/ruma-api-macros"
version = "0.21.0"
version = "0.21.1"
[dependencies]
syn = { version = "1.0.18", features = ["full"] }
syn = { version = "1.0.19", features = ["full"] }
quote = "1.0.4"
proc-macro2 = "1.0.12"
@ -24,4 +24,4 @@ proc-macro = true
ruma-identifiers = "0.16.1"
serde_json = "1.0.52"
js_int = { version = "0.1.5", features = ["serde"] }
serde = { version = "1.0.106", features = ["derive"] }
serde = { version = "1.0.107", features = ["derive"] }

View File

@ -31,10 +31,15 @@ impl<T> EventJson<T> {
}
}
/// Access the underlying `RawValue`.
/// Access the underlying json value.
pub fn json(&self) -> &RawValue {
&self.json
}
/// Convert `self` into the underlying json value.
pub fn into_json(self) -> Box<RawValue> {
self.json
}
}
impl<T: TryFromRaw> EventJson<T> {