From 8e2c4b5cb779b28a62403218c0baebeda44f2fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 30 Jul 2022 14:38:17 +0200 Subject: [PATCH] api: Make Clone a supertrait of OutgoingRequest Allow to retry a request. --- crates/ruma-common/CHANGELOG.md | 1 + crates/ruma-common/src/api.rs | 2 +- crates/ruma-common/tests/api/manual_endpoint_impl.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ruma-common/CHANGELOG.md b/crates/ruma-common/CHANGELOG.md index ee142855..5b016c59 100644 --- a/crates/ruma-common/CHANGELOG.md +++ b/crates/ruma-common/CHANGELOG.md @@ -26,6 +26,7 @@ Breaking changes: * Split `RoomId` matrix URI constructors between methods with and without routing * Allow to add routing servers to `RoomId::matrix_to_event_uri()` * Move `receipt::ReceiptType` to `events::receipt` +* Make `Clone` as supertrait of `api::OutgoingRequest` [spec]: https://github.com/matrix-org/matrix-spec-proposals/pull/3669 diff --git a/crates/ruma-common/src/api.rs b/crates/ruma-common/src/api.rs index cc8103a5..800369f1 100644 --- a/crates/ruma-common/src/api.rs +++ b/crates/ruma-common/src/api.rs @@ -240,7 +240,7 @@ impl<'a> SendAccessToken<'a> { } /// A request type for a Matrix API endpoint, used for sending requests. -pub trait OutgoingRequest: Sized { +pub trait OutgoingRequest: Sized + Clone { /// A type capturing the expected error conditions the server can return. type EndpointError: EndpointError; diff --git a/crates/ruma-common/tests/api/manual_endpoint_impl.rs b/crates/ruma-common/tests/api/manual_endpoint_impl.rs index 888c9a84..6faa13c0 100644 --- a/crates/ruma-common/tests/api/manual_endpoint_impl.rs +++ b/crates/ruma-common/tests/api/manual_endpoint_impl.rs @@ -17,7 +17,7 @@ use ruma_common::{ use serde::{Deserialize, Serialize}; /// A request to create a new room alias. -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Request { pub room_id: OwnedRoomId, // body pub room_alias: OwnedRoomAliasId, // path