optimize with SmallString; consolidate related re-exports

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-02-08 00:16:37 +00:00 committed by strawberry
commit b872f8e593
39 changed files with 113 additions and 96 deletions

View file

@ -8,6 +8,7 @@ mod id;
mod raw_id;
mod redact;
mod relation;
mod state_key;
mod strip;
#[cfg(test)]
mod tests;
@ -17,7 +18,7 @@ use std::cmp::Ordering;
use ruma::{
events::TimelineEventType, CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId,
OwnedRoomId, OwnedUserId, UInt,
OwnedRoomId, OwnedServerName, OwnedUserId, UInt,
};
use serde::{Deserialize, Serialize};
use serde_json::value::RawValue as RawJsonValue;
@ -29,6 +30,7 @@ pub use self::{
event_id::*,
id::*,
raw_id::*,
state_key::{ShortStateKey, StateKey},
Count as PduCount, Id as PduId, Pdu as PduEvent, RawId as RawPduId,
};
use crate::Result;
@ -40,13 +42,13 @@ pub struct Pdu {
pub room_id: OwnedRoomId,
pub sender: OwnedUserId,
#[serde(skip_serializing_if = "Option::is_none")]
pub origin: Option<String>,
pub origin: Option<OwnedServerName>,
pub origin_server_ts: UInt,
#[serde(rename = "type")]
pub kind: TimelineEventType,
pub content: Box<RawJsonValue>,
#[serde(skip_serializing_if = "Option::is_none")]
pub state_key: Option<String>,
pub state_key: Option<StateKey>,
pub prev_events: Vec<OwnedEventId>,
pub depth: UInt,
pub auth_events: Vec<OwnedEventId>,