Skip to content

Commit 9a5824a

Browse files
committed
update rust samples
1 parent ac5d897 commit 9a5824a

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

  • samples/client/others/rust/reqwest-deep-object-free-form-query-param/src/apis

‎samples/client/others/rust/reqwest-deep-object-free-form-query-param/src/apis/configuration.rs‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
pub use reqwest::blocking::Client;
1313

14-
#[derive(Debug, Clone)]
14+
#[derive(Clone)]
1515
pub struct Configuration {
1616
pub base_path: String,
1717
pub user_agent: Option<String>,
@@ -24,12 +24,37 @@ pub struct Configuration {
2424

2525
pub type BasicAuth = (String, Option<String>);
2626

27-
#[derive(Debug, Clone)]
27+
#[derive(Clone)]
2828
pub struct ApiKey {
2929
pub prefix: Option<String>,
3030
pub key: String,
3131
}
3232

33+
impl std::fmt::Debug for ApiKey {
34+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35+
f.debug_struct("ApiKey")
36+
.field("prefix", &self.prefix)
37+
.field("key", &"[REDACTED]")
38+
.finish()
39+
}
40+
}
41+
42+
43+
impl std::fmt::Debug for Configuration {
44+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45+
let mut debug = f.debug_struct("Configuration");
46+
debug
47+
.field("base_path", &self.base_path)
48+
.field("user_agent", &self.user_agent)
49+
.field("client", &self.client);
50+
debug
51+
.field("basic_auth", &self.basic_auth.as_ref().map(|(username, password)| (username, password.as_ref().map(|_| "[REDACTED]"))))
52+
.field("oauth_access_token", &self.oauth_access_token.as_ref().map(|_| "[REDACTED]"))
53+
.field("bearer_access_token", &self.bearer_access_token.as_ref().map(|_| "[REDACTED]"))
54+
.field("api_key", &self.api_key);
55+
debug.finish()
56+
}
57+
}
3358

3459
impl Configuration {
3560
pub fn new() -> Configuration {

0 commit comments

Comments
 (0)