Inline handle_sync_events_wrapped
It was only used in one place.
This commit is contained in:
parent
b94faa3121
commit
8f46a87f52
1 changed files with 10 additions and 20 deletions
|
@ -211,7 +211,16 @@ impl Client {
|
|||
room: &Option<room::Room>,
|
||||
events: &[Raw<T>],
|
||||
) -> serde_json::Result<()> {
|
||||
self.handle_sync_events_wrapped(kind, room, events, |x| x).await
|
||||
#[derive(Deserialize)]
|
||||
struct ExtractType<'a> {
|
||||
#[serde(borrow, rename = "type")]
|
||||
event_type: Cow<'a, str>,
|
||||
}
|
||||
|
||||
self.handle_sync_events_wrapped_with(room, events, std::convert::identity, |raw| {
|
||||
Ok((kind, raw.deserialize_as::<ExtractType>()?.event_type))
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn handle_sync_state_events(
|
||||
|
@ -268,25 +277,6 @@ impl Client {
|
|||
.await
|
||||
}
|
||||
|
||||
async fn handle_sync_events_wrapped<'a, T: 'a, U: 'a>(
|
||||
&self,
|
||||
kind: EventKind,
|
||||
room: &Option<room::Room>,
|
||||
events: &'a [U],
|
||||
get_event: impl Fn(&'a U) -> &'a Raw<T>,
|
||||
) -> Result<(), serde_json::Error> {
|
||||
#[derive(Deserialize)]
|
||||
struct ExtractType<'a> {
|
||||
#[serde(borrow, rename = "type")]
|
||||
event_type: Cow<'a, str>,
|
||||
}
|
||||
|
||||
self.handle_sync_events_wrapped_with(room, events, get_event, |raw| {
|
||||
Ok((kind, raw.deserialize_as::<ExtractType>()?.event_type))
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
async fn handle_sync_events_wrapped_with<'a, T: 'a, U: 'a>(
|
||||
&self,
|
||||
room: &Option<room::Room>,
|
||||
|
|
Loading…
Reference in a new issue