chore: Rename BackingStore::Error to BackingStore::LockingError.

The idea is to avoid name conflicts when implementing other traits
that use the `Error` associated type.
This commit is contained in:
Ivan Enderlin
2024-10-30 11:06:15 +01:00
parent e5d4ea5964
commit 9f11bced10
2 changed files with 6 additions and 6 deletions

View File

@@ -58,7 +58,7 @@ use crate::{
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
pub trait BackingStore {
type Error: Error + Send + Sync;
type LockError: Error + Send + Sync;
/// Try to take a lock using the given store.
async fn try_lock(
@@ -66,7 +66,7 @@ pub trait BackingStore {
lease_duration_ms: u32,
key: &str,
holder: &str,
) -> Result<bool, Self::Error>;
) -> Result<bool, Self::LockError>;
}
/// Small state machine to handle wait times.
@@ -400,7 +400,7 @@ mod tests {
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
impl BackingStore for TestStore {
type Error = DummyError;
type LockError = DummyError;
/// Try to take a lock using the given store.
async fn try_lock(
@@ -408,7 +408,7 @@ mod tests {
lease_duration_ms: u32,
key: &str,
holder: &str,
) -> Result<bool, Self::Error> {
) -> Result<bool, Self::LockError> {
Ok(self.try_take_leased_lock(lease_duration_ms, key, holder))
}
}

View File

@@ -1925,14 +1925,14 @@ pub struct LockableCryptoStore(Arc<dyn CryptoStore<Error = CryptoStoreError>>);
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
impl matrix_sdk_common::store_locks::BackingStore for LockableCryptoStore {
type Error = CryptoStoreError;
type LockError = CryptoStoreError;
async fn try_lock(
&self,
lease_duration_ms: u32,
key: &str,
holder: &str,
) -> std::result::Result<bool, Self::Error> {
) -> std::result::Result<bool, Self::LockError> {
self.0.try_take_leased_lock(lease_duration_ms, key, holder).await
}
}