Skip to content

Commit

Permalink
feat: add 'unstable' option for WASM client in 'ClientOptions'
Browse files Browse the repository at this point in the history
This new feature will allow the usage of 'unstable' features by the WASM
client.
  • Loading branch information
jpraynaud committed Sep 3, 2024
1 parent ffc7943 commit 089e20d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion mithril-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,27 @@ use crate::MithrilResult;
pub struct ClientOptions {
/// HTTP headers to include in the client requests.
pub http_headers: Option<HashMap<String, String>>,

/// Whether to enable unstable features in the WASM client.
#[cfg(target_family = "wasm")]
#[cfg_attr(target_family = "wasm", serde(default))]
pub unstable: bool,
}

impl ClientOptions {
/// Instantiate a new [ClientOptions].
pub fn new(http_headers: Option<HashMap<String, String>>) -> Self {
Self { http_headers }
Self {
http_headers,
#[cfg(target_family = "wasm")]
unstable: false,
}
}

/// Enable unstable features in the WASM client.
#[cfg(target_family = "wasm")]
pub fn with_unstable_features(self, unstable: bool) -> Self {
Self { unstable, ..self }
}
}

Expand Down

0 comments on commit 089e20d

Please sign in to comment.