mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2025-12-14 03:08:57 -05:00
optimize with SmallString; consolidate related re-exports
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
ecc9099127
commit
b872f8e593
39 changed files with 113 additions and 96 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use std::borrow::Borrow;
|
||||
|
||||
use conduwuit::{err, implement, PduEvent, Result};
|
||||
use conduwuit::{err, implement, PduEvent, Result, StateKey};
|
||||
use futures::{Stream, StreamExt, TryFutureExt};
|
||||
use ruma::{events::StateEventType, EventId, RoomId};
|
||||
use serde::Deserialize;
|
||||
|
|
@ -27,7 +27,7 @@ where
|
|||
pub fn room_state_full<'a>(
|
||||
&'a self,
|
||||
room_id: &'a RoomId,
|
||||
) -> impl Stream<Item = Result<((StateEventType, String), PduEvent)>> + Send + 'a {
|
||||
) -> impl Stream<Item = Result<((StateEventType, StateKey), PduEvent)>> + Send + 'a {
|
||||
self.services
|
||||
.state
|
||||
.get_room_shortstatehash(room_id)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use conduwuit::{
|
|||
result::FlatOk,
|
||||
stream::{BroadbandExt, IterStream, ReadyExt, TryExpect},
|
||||
},
|
||||
PduEvent, Result,
|
||||
PduEvent, Result, StateKey,
|
||||
};
|
||||
use database::Deserialized;
|
||||
use futures::{future::try_join, pin_mut, FutureExt, Stream, StreamExt, TryFutureExt};
|
||||
|
|
@ -192,7 +192,7 @@ pub fn state_keys_with_ids<'a, Id>(
|
|||
&'a self,
|
||||
shortstatehash: ShortStateHash,
|
||||
event_type: &'a StateEventType,
|
||||
) -> impl Stream<Item = (String, Id)> + Send + 'a
|
||||
) -> impl Stream<Item = (StateKey, Id)> + Send + 'a
|
||||
where
|
||||
Id: for<'de> Deserialize<'de> + Send + Sized + ToOwned + 'a,
|
||||
<Id as ToOwned>::Owned: Borrow<EventId>,
|
||||
|
|
@ -200,7 +200,7 @@ where
|
|||
let state_keys_with_short_ids = self
|
||||
.state_keys_with_shortids(shortstatehash, event_type)
|
||||
.unzip()
|
||||
.map(|(ssks, sids): (Vec<String>, Vec<u64>)| (ssks, sids))
|
||||
.map(|(ssks, sids): (Vec<StateKey>, Vec<u64>)| (ssks, sids))
|
||||
.shared();
|
||||
|
||||
let state_keys = state_keys_with_short_ids
|
||||
|
|
@ -230,7 +230,7 @@ pub fn state_keys_with_shortids<'a>(
|
|||
&'a self,
|
||||
shortstatehash: ShortStateHash,
|
||||
event_type: &'a StateEventType,
|
||||
) -> impl Stream<Item = (String, ShortEventId)> + Send + 'a {
|
||||
) -> impl Stream<Item = (StateKey, ShortEventId)> + Send + 'a {
|
||||
let short_ids = self
|
||||
.state_full_shortids(shortstatehash)
|
||||
.expect_ok()
|
||||
|
|
@ -267,7 +267,7 @@ pub fn state_keys<'a>(
|
|||
&'a self,
|
||||
shortstatehash: ShortStateHash,
|
||||
event_type: &'a StateEventType,
|
||||
) -> impl Stream<Item = String> + Send + 'a {
|
||||
) -> impl Stream<Item = StateKey> + Send + 'a {
|
||||
let short_ids = self
|
||||
.state_full_shortids(shortstatehash)
|
||||
.expect_ok()
|
||||
|
|
@ -314,7 +314,7 @@ pub fn state_added(
|
|||
pub fn state_full(
|
||||
&self,
|
||||
shortstatehash: ShortStateHash,
|
||||
) -> impl Stream<Item = ((StateEventType, String), PduEvent)> + Send + '_ {
|
||||
) -> impl Stream<Item = ((StateEventType, StateKey), PduEvent)> + Send + '_ {
|
||||
self.state_full_pdus(shortstatehash)
|
||||
.ready_filter_map(|pdu| {
|
||||
Some(((pdu.kind.to_string().into(), pdu.state_key.clone()?), pdu))
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ pub async fn user_can_invite(
|
|||
.timeline
|
||||
.create_hash_and_sign_event(
|
||||
PduBuilder::state(
|
||||
target_user.into(),
|
||||
target_user.as_str(),
|
||||
&RoomMemberEventContent::new(MembershipState::Invite),
|
||||
),
|
||||
sender,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue