matrix-sdk: Implement EncodeKey for EventType
parent
3f2c5d22b6
commit
f6c4fdde7d
|
@ -134,6 +134,12 @@ impl EncodeKey for (&str, &str, &str) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl EncodeKey for EventType {
|
||||||
|
fn encode(&self) -> Vec<u8> {
|
||||||
|
self.as_str().encode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct SledStore {
|
pub struct SledStore {
|
||||||
path: Option<PathBuf>,
|
path: Option<PathBuf>,
|
||||||
|
@ -495,7 +501,7 @@ impl SledStore {
|
||||||
) -> Result<Option<AnySyncStateEvent>> {
|
) -> Result<Option<AnySyncStateEvent>> {
|
||||||
Ok(self
|
Ok(self
|
||||||
.room_state
|
.room_state
|
||||||
.get((room_id.as_str(), event_type.to_string().as_str(), state_key).encode())?
|
.get((room_id.as_str(), event_type.as_str(), state_key).encode())?
|
||||||
.map(|e| self.deserialize_event(&e))
|
.map(|e| self.deserialize_event(&e))
|
||||||
.transpose()?)
|
.transpose()?)
|
||||||
}
|
}
|
||||||
|
@ -594,7 +600,7 @@ impl SledStore {
|
||||||
) -> Result<Option<AnyBasicEvent>> {
|
) -> Result<Option<AnyBasicEvent>> {
|
||||||
Ok(self
|
Ok(self
|
||||||
.account_data
|
.account_data
|
||||||
.get(event_type.to_string().as_str().encode())?
|
.get(event_type.encode())?
|
||||||
.map(|m| self.deserialize_event(&m))
|
.map(|m| self.deserialize_event(&m))
|
||||||
.transpose()?)
|
.transpose()?)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue