Skip to content

Commit

Permalink
compiler fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardTibben committed Jul 26, 2024
1 parent f1c3265 commit 4aa690a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
11 changes: 10 additions & 1 deletion stellar_rust_sdk/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,21 @@ impl std::fmt::Display for Order {
}
}

#[derive(Default)]
#[derive(Default, Clone, PartialEq)]
pub enum IncludeFailed {
True,
#[default]
False,
}
//
// impl AsRef<str> for IncludeFailed {
// fn as_ref(&self) -> &str {
// match self {
// IncludeFailed::True => "true",
// IncludeFailed::False => "false",
// }
// }
// }

impl std::fmt::Display for IncludeFailed {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
8 changes: 4 additions & 4 deletions stellar_rust_sdk/src/payments/payments_for_account_request.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::models::{IncludeFailed, Order, Request};
use crate::payments::PAYMENTS_PATH;
use crate::Paginatable;
use crate::{BuildQueryParametersExt, Paginatable};
use stellar_rust_sdk_derive::Pagination;

#[derive(Default, Pagination)]
Expand All @@ -16,7 +16,7 @@ pub struct PaymentsForAccountRequest {
/// and [`Order::Desc`] (descending). If not specified, it defaults to ascending.
order: Option<Order>,
/// A boolean value that determines whether failed transactions should be included in the response.
include_failed: IncludeFailed,
include_failed: Option<IncludeFailed>,
}

impl PaymentsForAccountRequest {
Expand All @@ -27,7 +27,7 @@ impl PaymentsForAccountRequest {
cursor: None,
limit: None,
order: None,
include_failed: IncludeFailed::False,
include_failed: Option::from(IncludeFailed::False),
}
}

Expand All @@ -51,7 +51,7 @@ impl PaymentsForAccountRequest {
mut self,
include_failed: IncludeFailed,
) -> PaymentsForAccountRequest {
self.include_failed = include_failed;
self.include_failed = Option::from(include_failed);
self
}
}
Expand Down
11 changes: 5 additions & 6 deletions stellar_rust_sdk/src/payments/payments_for_ledger_request.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::models::{IncludeFailed, Order, Request};
use crate::payments::PAYMENTS_PATH;
use crate::Paginatable;
use crate::{BuildQueryParametersExt, Paginatable};
use stellar_rust_sdk_derive::Pagination;

#[derive(Default, Pagination)]
Expand All @@ -16,7 +16,7 @@ pub struct PaymentsForLedgerRequest {
/// and [`Order::Desc`] (descending). If not specified, it defaults to ascending.
order: Option<Order>,
/// A boolean value that determines whether failed transactions should be included in the response.
include_failed: IncludeFailed,
include_failed: Option<IncludeFailed>,
}

impl PaymentsForLedgerRequest {
Expand All @@ -27,7 +27,7 @@ impl PaymentsForLedgerRequest {
cursor: None,
limit: None,
order: None,
include_failed: IncludeFailed::False,
include_failed: Option::from(IncludeFailed::False),
}
}

Expand All @@ -47,7 +47,7 @@ impl PaymentsForLedgerRequest {
/// * `include_failed` - A boolean value that determines whether to include failed operations in the response.
///
pub fn set_include_failed(mut self, include_failed: IncludeFailed) -> PaymentsForLedgerRequest {
self.include_failed = include_failed;
self.include_failed = Option::from(include_failed);
self
}
}
Expand All @@ -59,8 +59,7 @@ impl Request for PaymentsForLedgerRequest {
self.cursor.as_ref().map(|c| format!("cursor={}", c)),
self.limit.as_ref().map(|l| format!("limit={}", l)),
self.order.as_ref().map(|o| format!("order={}", o)),
]
.build_query_parameters()
].build_query_parameters()
}

fn build_url(&self, base_url: &str) -> String {
Expand Down

0 comments on commit 4aa690a

Please sign in to comment.