Skip to content

Commit 03df752

Browse files
Merge pull request #55 from CleverCloud/clg/maybe-sized
feat: remove implicit Sized bound on request payload
2 parents f7019ea + 27f7244 commit 03df752

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/client/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub trait Request {
8383
payload: &T,
8484
) -> impl Future<Output = Result<U, Self::Error>> + Send
8585
where
86-
T: Serialize + Debug + Send + Sync,
86+
T: ?Sized + Serialize + Debug + Send + Sync,
8787
U: DeserializeOwned + Debug + Send + Sync;
8888

8989
fn execute(
@@ -108,7 +108,7 @@ pub trait RestClient: Debug {
108108
payload: &T,
109109
) -> impl Future<Output = Result<U, Self::Error>> + Send
110110
where
111-
T: Serialize + Debug + Send + Sync,
111+
T: ?Sized + Serialize + Debug + Send + Sync,
112112
U: DeserializeOwned + Debug + Send + Sync;
113113

114114
fn put<T, U>(
@@ -117,7 +117,7 @@ pub trait RestClient: Debug {
117117
payload: &T,
118118
) -> impl Future<Output = Result<U, Self::Error>> + Send
119119
where
120-
T: Serialize + Debug + Send + Sync,
120+
T: ?Sized + Serialize + Debug + Send + Sync,
121121
U: DeserializeOwned + Debug + Send + Sync;
122122

123123
fn patch<T, U>(
@@ -126,7 +126,7 @@ pub trait RestClient: Debug {
126126
payload: &T,
127127
) -> impl Future<Output = Result<U, Self::Error>> + Send
128128
where
129-
T: Serialize + Debug + Send + Sync,
129+
T: ?Sized + Serialize + Debug + Send + Sync,
130130
U: DeserializeOwned + Debug + Send + Sync;
131131

132132
fn delete(&self, endpoint: &str) -> impl Future<Output = Result<(), Self::Error>> + Send;
@@ -457,7 +457,7 @@ impl Request for Client {
457457
payload: &T,
458458
) -> Result<U, Self::Error>
459459
where
460-
T: Serialize + Debug + Send + Sync,
460+
T: ?Sized + Serialize + Debug + Send + Sync,
461461
U: DeserializeOwned + Debug + Send + Sync,
462462
{
463463
let buf = serde_json::to_vec(payload).map_err(ClientError::Serialize)?;
@@ -616,7 +616,7 @@ impl RestClient for Client {
616616
#[cfg_attr(feature = "tracing", tracing::instrument)]
617617
async fn post<T, U>(&self, endpoint: &str, payload: &T) -> Result<U, Self::Error>
618618
where
619-
T: Serialize + Debug + Send + Sync,
619+
T: ?Sized + Serialize + Debug + Send + Sync,
620620
U: DeserializeOwned + Debug + Send + Sync,
621621
{
622622
self.request(&Method::POST, endpoint, payload).await
@@ -625,7 +625,7 @@ impl RestClient for Client {
625625
#[cfg_attr(feature = "tracing", tracing::instrument)]
626626
async fn put<T, U>(&self, endpoint: &str, payload: &T) -> Result<U, Self::Error>
627627
where
628-
T: Serialize + Debug + Send + Sync,
628+
T: ?Sized + Serialize + Debug + Send + Sync,
629629
U: DeserializeOwned + Debug + Send + Sync,
630630
{
631631
self.request(&Method::PUT, endpoint, payload).await
@@ -634,7 +634,7 @@ impl RestClient for Client {
634634
#[cfg_attr(feature = "tracing", tracing::instrument)]
635635
async fn patch<T, U>(&self, endpoint: &str, payload: &T) -> Result<U, Self::Error>
636636
where
637-
T: Serialize + Debug + Send + Sync,
637+
T: ?Sized + Serialize + Debug + Send + Sync,
638638
U: DeserializeOwned + Debug + Send + Sync,
639639
{
640640
self.request(&Method::PATCH, endpoint, payload).await

0 commit comments

Comments
 (0)