From 48660c482fa86825364e1a77937ed3b2af8faa6d Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 11 Mar 2022 11:49:41 +0100 Subject: [PATCH] Use regular builder pattern for ClientConfig::store_config --- crates/matrix-sdk/src/config/client.rs | 8 +++++--- crates/matrix-sdk/src/store.rs | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/matrix-sdk/src/config/client.rs b/crates/matrix-sdk/src/config/client.rs index 3a554f546..b4389b164 100644 --- a/crates/matrix-sdk/src/config/client.rs +++ b/crates/matrix-sdk/src/config/client.rs @@ -122,7 +122,8 @@ impl ClientConfig { /// use matrix_sdk::{Client, config::{ClientConfig, StoreConfig}}; /// /// let store_config = StoreConfig::new().state_store(custom_state_store); - /// let client_config = ClientConfig::with_store_config(store_config) + /// let client_config = ClientConfig::new() + /// .store_config(store_config) /// .use_discovery_response(); /// /// # Result::<_, matrix_sdk::Error>::Ok(()) @@ -130,8 +131,9 @@ impl ClientConfig { /// ``` /// [`make_store_config`]: crate::store::make_store_config /// [`store`]: crate::store - pub fn with_store_config(store_config: StoreConfig) -> Self { - Self { store_config, ..Default::default() } + pub fn store_config(mut self, store_config: StoreConfig) -> Self { + self.store_config = store_config; + self } /// Set the proxy through which all the HTTP requests should go. diff --git a/crates/matrix-sdk/src/store.rs b/crates/matrix-sdk/src/store.rs index b31b58334..60d123463 100644 --- a/crates/matrix-sdk/src/store.rs +++ b/crates/matrix-sdk/src/store.rs @@ -24,10 +24,10 @@ //! implementation for WebAssembly. //! //! Both options provide a `make_store_config` convenience method to create a -//! [`StoreConfig`] for [`ClientConfig::with_store_config()`]. +//! [`StoreConfig`] for [`ClientConfig::store_config()`]. //! //! [`StoreConfig`]: crate::config::StoreConfig -//! [`ClientConfig::with_store_config()`]: crate::config::ClientConfig::with_store_config() +//! [`ClientConfig::store_config()`]: crate::config::ClientConfig::store_config() #[cfg(any(feature = "indexeddb_state_store", feature = "indexeddb_cryptostore"))] pub use matrix_sdk_indexeddb::*;