mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-09 20:31:05 +01:00
Merge branch 'serde-cleanup' into 'next'
Remove useless serde roundtrips See merge request famedly/conduit!311
This commit is contained in:
commit
c496e599ef
2 changed files with 3 additions and 37 deletions
|
@ -149,19 +149,7 @@ pub(crate) async fn get_public_rooms_filtered_helper(
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
return Ok(get_public_rooms_filtered::Response {
|
return Ok(get_public_rooms_filtered::Response {
|
||||||
chunk: response
|
chunk: response.chunk,
|
||||||
.chunk
|
|
||||||
.into_iter()
|
|
||||||
.map(|c| {
|
|
||||||
// Convert ruma::api::federation::directory::get_public_rooms::v1::PublicRoomsChunk
|
|
||||||
// to ruma::api::client::r0::directory::PublicRoomsChunk
|
|
||||||
serde_json::from_str(
|
|
||||||
&serde_json::to_string(&c)
|
|
||||||
.expect("PublicRoomsChunk::to_string always works"),
|
|
||||||
)
|
|
||||||
.expect("federation and client-server PublicRoomsChunk are the same type")
|
|
||||||
})
|
|
||||||
.collect(),
|
|
||||||
prev_batch: response.prev_batch,
|
prev_batch: response.prev_batch,
|
||||||
next_batch: response.next_batch,
|
next_batch: response.next_batch,
|
||||||
total_room_count_estimate: response.total_room_count_estimate,
|
total_room_count_estimate: response.total_room_count_estimate,
|
||||||
|
|
|
@ -591,18 +591,7 @@ pub async fn get_public_rooms_filtered_route(
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(get_public_rooms_filtered::v1::Response {
|
Ok(get_public_rooms_filtered::v1::Response {
|
||||||
chunk: response
|
chunk: response.chunk,
|
||||||
.chunk
|
|
||||||
.into_iter()
|
|
||||||
.map(|c| {
|
|
||||||
// Convert ruma::api::federation::directory::get_public_rooms::v1::PublicRoomsChunk
|
|
||||||
// to ruma::api::client::r0::directory::PublicRoomsChunk
|
|
||||||
serde_json::from_str(
|
|
||||||
&serde_json::to_string(&c).expect("PublicRoomsChunk::to_string always works"),
|
|
||||||
)
|
|
||||||
.expect("federation and client-server PublicRoomsChunk are the same type")
|
|
||||||
})
|
|
||||||
.collect(),
|
|
||||||
prev_batch: response.prev_batch,
|
prev_batch: response.prev_batch,
|
||||||
next_batch: response.next_batch,
|
next_batch: response.next_batch,
|
||||||
total_room_count_estimate: response.total_room_count_estimate,
|
total_room_count_estimate: response.total_room_count_estimate,
|
||||||
|
@ -631,18 +620,7 @@ pub async fn get_public_rooms_route(
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(get_public_rooms::v1::Response {
|
Ok(get_public_rooms::v1::Response {
|
||||||
chunk: response
|
chunk: response.chunk,
|
||||||
.chunk
|
|
||||||
.into_iter()
|
|
||||||
.map(|c| {
|
|
||||||
// Convert ruma::api::federation::directory::get_public_rooms::v1::PublicRoomsChunk
|
|
||||||
// to ruma::api::client::r0::directory::PublicRoomsChunk
|
|
||||||
serde_json::from_str(
|
|
||||||
&serde_json::to_string(&c).expect("PublicRoomsChunk::to_string always works"),
|
|
||||||
)
|
|
||||||
.expect("federation and client-server PublicRoomsChunk are the same type")
|
|
||||||
})
|
|
||||||
.collect(),
|
|
||||||
prev_batch: response.prev_batch,
|
prev_batch: response.prev_batch,
|
||||||
next_batch: response.next_batch,
|
next_batch: response.next_batch,
|
||||||
total_room_count_estimate: response.total_room_count_estimate,
|
total_room_count_estimate: response.total_room_count_estimate,
|
||||||
|
|
Loading…
Reference in a new issue