Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleades committed Dec 28, 2023
1 parent 726da2f commit 5625992
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
8 changes: 2 additions & 6 deletions src/endpoints/feed_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -128,8 +123,9 @@ pub(crate) mod basic {

type IntoFuture = impl Future<Output = Self::Output>;

/// Consume and send the [`Request`].
fn into_future(self) -> Self::IntoFuture {
self.send()
async move { self.client.handle_request(&self).await }
}
}

Expand Down
8 changes: 2 additions & 6 deletions src/endpoints/transactions/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,15 @@ where
self.expand_merchant = true;
self
}

/// Consume the request and return the [`Transaction`]
async fn send(self) -> Result<Transaction> {
self.client.handle_request(&self).await
}
}

impl<'a> IntoFuture for Request<'a> {

Check failure on line 60 in src/endpoints/transactions/get.rs

View workflow job for this annotation

GitHub Actions / lint

struct takes 1 generic argument but 0 generic arguments were supplied

error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> src/endpoints/transactions/get.rs:60:25 | 60 | impl<'a> IntoFuture for Request<'a> { | ^^^^^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `C` --> src/endpoints/transactions/get.rs:11:12 | 11 | pub struct Request<'a, C> | ^^^^^^^ - help: add missing generic argument | 60 | impl<'a> IntoFuture for Request<'a, C> { | +++
type Output = Result<Transaction>;

type IntoFuture = impl Future<Output = Self::Output>;

/// Consume the request and return the [`Transaction`]
fn into_future(self) -> Self::IntoFuture {
self.send()
async move { self.client.handle_request(&self).await }
}
}
22 changes: 9 additions & 13 deletions src/endpoints/transactions/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,23 @@ where
self.query.expand_merchant = Some("merchant");
self
}

/// Consume the request and return the list of [`Transaction`]s
async fn send(self) -> Result<Vec<Transaction>> {
#[derive(Deserialize)]
struct Response {
transactions: Vec<Transaction>,
}

let response: Response = self.client.handle_request(&self).await?;

Ok(response.transactions)
}
}

impl<'a> IntoFuture for Request<'a> {

Check failure on line 85 in src/endpoints/transactions/list.rs

View workflow job for this annotation

GitHub Actions / lint

struct takes 1 generic argument but 0 generic arguments were supplied

error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> src/endpoints/transactions/list.rs:85:25 | 85 | impl<'a> IntoFuture for Request<'a> { | ^^^^^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `C` --> src/endpoints/transactions/list.rs:14:12 | 14 | pub struct Request<'a, C> | ^^^^^^^ - help: add missing generic argument | 85 | impl<'a> IntoFuture for Request<'a, C> { | +++
type Output = Result<Vec<Transaction>>;

type IntoFuture = impl Future<Output = Self::Output>;

/// Consume the request and return the list of [`Transaction`]s
fn into_future(self) -> Self::IntoFuture {
self.send()
#[derive(Deserialize)]
struct Response {
transactions: Vec<Transaction>,
}
async move {
let response: Response = self.client.handle_request(&self).await?;
Ok(response.transactions)
}
}
}

Expand Down

0 comments on commit 5625992

Please sign in to comment.