From 3d31b81abfddb47af3030cd8b4afd85ddadcd8ad Mon Sep 17 00:00:00 2001 From: Michael Goldenberg Date: Mon, 20 Oct 2025 11:00:41 -0400 Subject: [PATCH] refactor(indexeddb): add type synonym for content id in indexed media content key Signed-off-by: Michael Goldenberg --- .../src/media_store/serializer/indexed_types.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk-indexeddb/src/media_store/serializer/indexed_types.rs b/crates/matrix-sdk-indexeddb/src/media_store/serializer/indexed_types.rs index 0a6702773..c52833110 100644 --- a/crates/matrix-sdk-indexeddb/src/media_store/serializer/indexed_types.rs +++ b/crates/matrix-sdk-indexeddb/src/media_store/serializer/indexed_types.rs @@ -81,6 +81,9 @@ pub type IndexedMediaMetadataContent = MaybeEncrypted; /// is suitable for use in an IndexedDB key pub type IndexedMediaContentSize = usize; +/// A representation of the identifier [`MediaContent::id`] +pub type IndexedMediaContentId = u64; + /// A (possibly) encrypted representation of [`MediaContent::data`] pub type IndexedMediaContentData = Vec; @@ -952,7 +955,7 @@ impl Indexed for MediaContent { /// /// [1]: crate::media_store::migrations::v1::create_media_content_object_store #[derive(Debug, Serialize, Deserialize)] -pub struct IndexedMediaContentIdKey(u64); +pub struct IndexedMediaContentIdKey(IndexedMediaContentId); impl Deref for IndexedMediaContentIdKey { type Target = u64; @@ -963,7 +966,7 @@ impl Deref for IndexedMediaContentIdKey { } impl IndexedKey for IndexedMediaContentIdKey { - type KeyComponents<'a> = u64; + type KeyComponents<'a> = IndexedMediaContentId; fn encode(components: Self::KeyComponents<'_>, _: &SafeEncodeSerializer) -> Self { Self(components)