client-api: Simplify r0::room::create_room::CreationContent::into_event_content
using the assign crate
This commit is contained in:
parent
a1916837f9
commit
6f805d2584
@ -17,6 +17,7 @@ version = "0.10.0-alpha.1"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
assign = "1.1.0"
|
||||||
http = "0.2.1"
|
http = "0.2.1"
|
||||||
js_int = { version = "0.1.9", features = ["serde"] }
|
js_int = { version = "0.1.9", features = ["serde"] }
|
||||||
ruma-api = { version = "=0.17.0-alpha.1", path = "../ruma-api" }
|
ruma-api = { version = "=0.17.0-alpha.1", path = "../ruma-api" }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
//! [POST /_matrix/client/r0/createRoom](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-createroom)
|
//! [POST /_matrix/client/r0/createRoom](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-createroom)
|
||||||
|
|
||||||
|
use assign::assign;
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_common::Raw;
|
use ruma_common::Raw;
|
||||||
use ruma_events::{
|
use ruma_events::{
|
||||||
@ -141,11 +142,7 @@ impl CreationContent {
|
|||||||
creator: UserId,
|
creator: UserId,
|
||||||
room_version: RoomVersionId,
|
room_version: RoomVersionId,
|
||||||
) -> CreateEventContent {
|
) -> CreateEventContent {
|
||||||
let mut res = CreateEventContent::new(creator);
|
assign!(CreateEventContent::new(creator), { federate, room_version, predecessor })
|
||||||
res.federate = federate;
|
|
||||||
res.room_version = room_version;
|
|
||||||
res.predecessor = predecessor;
|
|
||||||
res
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user