From 5625992e3d2570351c81beee4dc7c5e4d068e909 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sat, 25 Nov 2023 11:26:41 +0000 Subject: [PATCH] tidy --- src/endpoints/feed_items.rs | 8 ++------ src/endpoints/transactions/get.rs | 8 ++------ src/endpoints/transactions/list.rs | 22 +++++++++------------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/endpoints/feed_items.rs b/src/endpoints/feed_items.rs index 7b19050..0a91683 100644 --- a/src/endpoints/feed_items.rs +++ b/src/endpoints/feed_items.rs @@ -101,11 +101,6 @@ pub(crate) mod basic { self.payload.params.body = Some(body); self } - - /// Consume and send the [`Request`]. - async fn send(self) -> Result<()> { - self.client.handle_request(&self).await - } } impl<'a, C> Endpoint for Request<'a, C> @@ -128,8 +123,9 @@ pub(crate) mod basic { type IntoFuture = impl Future; + /// Consume and send the [`Request`]. fn into_future(self) -> Self::IntoFuture { - self.send() + async move { self.client.handle_request(&self).await } } } diff --git a/src/endpoints/transactions/get.rs b/src/endpoints/transactions/get.rs index 4acc710..f006729 100644 --- a/src/endpoints/transactions/get.rs +++ b/src/endpoints/transactions/get.rs @@ -55,11 +55,6 @@ where self.expand_merchant = true; self } - - /// Consume the request and return the [`Transaction`] - async fn send(self) -> Result { - self.client.handle_request(&self).await - } } impl<'a> IntoFuture for Request<'a> { @@ -67,7 +62,8 @@ impl<'a> IntoFuture for Request<'a> { type IntoFuture = impl Future; + /// Consume the request and return the [`Transaction`] fn into_future(self) -> Self::IntoFuture { - self.send() + async move { self.client.handle_request(&self).await } } } diff --git a/src/endpoints/transactions/list.rs b/src/endpoints/transactions/list.rs index 2ca79c1..78a74e8 100644 --- a/src/endpoints/transactions/list.rs +++ b/src/endpoints/transactions/list.rs @@ -80,18 +80,6 @@ where self.query.expand_merchant = Some("merchant"); self } - - /// Consume the request and return the list of [`Transaction`]s - async fn send(self) -> Result> { - #[derive(Deserialize)] - struct Response { - transactions: Vec, - } - - let response: Response = self.client.handle_request(&self).await?; - - Ok(response.transactions) - } } impl<'a> IntoFuture for Request<'a> { @@ -99,8 +87,16 @@ impl<'a> IntoFuture for Request<'a> { type IntoFuture = impl Future; + /// Consume the request and return the list of [`Transaction`]s fn into_future(self) -> Self::IntoFuture { - self.send() + #[derive(Deserialize)] + struct Response { + transactions: Vec, + } + async move { + let response: Response = self.client.handle_request(&self).await?; + Ok(response.transactions) + } } }