Skip to content

Commit 0d417f3

Browse files
committed
feat: add 'unstable' option for WASM client in 'ClientOptions'
This new feature will allow the usage of 'unstable' features by the WASM client.
1 parent 1beeae8 commit 0d417f3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

mithril-client/src/client.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,27 @@ use crate::MithrilResult;
2727
pub struct ClientOptions {
2828
/// HTTP headers to include in the client requests.
2929
pub http_headers: Option<HashMap<String, String>>,
30+
31+
/// Whether to enable unstable features in the WASM client.
32+
#[cfg(target_family = "wasm")]
33+
#[cfg_attr(target_family = "wasm", serde(default))]
34+
pub unstable: bool,
3035
}
3136

3237
impl ClientOptions {
3338
/// Instantiate a new [ClientOptions].
3439
pub fn new(http_headers: Option<HashMap<String, String>>) -> Self {
35-
Self { http_headers }
40+
Self {
41+
http_headers,
42+
#[cfg(target_family = "wasm")]
43+
unstable: false,
44+
}
45+
}
46+
47+
/// Enable unstable features in the WASM client.
48+
#[cfg(target_family = "wasm")]
49+
pub fn with_unstable_features(self, unstable: bool) -> Self {
50+
Self { unstable, ..self }
3651
}
3752
}
3853

0 commit comments

Comments
 (0)