docs: Use new ClientBuilder methods in examples

This commit is contained in:
Jonas Platte
2022-07-29 15:24:21 +02:00
committed by Jonas Platte
parent 93c4c5d128
commit ffb4c6d6ef
2 changed files with 6 additions and 12 deletions

View File

@@ -47,16 +47,13 @@ async fn login_and_sync(
#[cfg(feature = "sled")]
{
// The location to save files to
let mut home = dirs::home_dir().expect("no home directory found");
home.push("autojoin_bot");
let state_store = matrix_sdk_sled::StateStore::builder().path(home).build()?;
client_builder = client_builder.state_store(state_store);
let home = dirs::home_dir().expect("no home directory found").join("autojoin_bot");
client_builder = client_builder.sled_store(home, None)?;
}
#[cfg(feature = "indexeddb")]
{
let state_store = matrix_sdk_indexeddb::StateStore::builder().build()?;
client_builder = client_builder.state_store(state_store);
client_builder = client_builder.indexeddb_store("autojoin_bot", None).await?;
}
let client = client_builder.build().await?;

View File

@@ -42,16 +42,13 @@ async fn login_and_sync(
#[cfg(feature = "sled")]
{
// The location to save files to
let mut home = dirs::home_dir().expect("no home directory found");
home.push("party_bot");
let state_store = matrix_sdk_sled::StateStore::builder().path(home).build()?;
client_builder = client_builder.state_store(state_store);
let home = dirs::home_dir().expect("no home directory found").join("party_bot");
client_builder = client_builder.sled_store(home, None)?;
}
#[cfg(feature = "indexeddb")]
{
let state_store = matrix_sdk_indexeddb::StateStore::builder().build().await?;
client_builder = client_builder.state_store(state_store);
client_builder = client_builder.indexeddb_store("party_bot", None).await?;
}
let client = client_builder.build().await.unwrap();