diff --git a/crates/ruma-state-res/src/state_event.rs b/crates/ruma-state-res/src/state_event.rs index ed5e0395..bea7be01 100644 --- a/crates/ruma-state-res/src/state_event.rs +++ b/crates/ruma-state-res/src/state_event.rs @@ -1,4 +1,4 @@ -use std::collections::BTreeMap; +use std::{collections::BTreeMap, sync::Arc}; use js_int::UInt; use ruma_common::MilliSecondsSinceUnixEpoch; @@ -55,3 +55,61 @@ pub trait Event { /// signature. fn signatures(&self) -> BTreeMap, BTreeMap>; } + +impl Event for Arc { + fn event_id(&self) -> &EventId { + (&**self).event_id() + } + + fn room_id(&self) -> &RoomId { + (&**self).room_id() + } + + fn sender(&self) -> &UserId { + (&**self).sender() + } + + fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch { + (&**self).origin_server_ts() + } + + fn event_type(&self) -> &EventType { + (&**self).event_type() + } + + fn content(&self) -> serde_json::Value { + (&**self).content() + } + + fn state_key(&self) -> Option<&str> { + (&**self).state_key() + } + + fn prev_events(&self) -> Box + '_> { + (&**self).prev_events() + } + + fn depth(&self) -> &UInt { + (&**self).depth() + } + + fn auth_events(&self) -> Box + '_> { + (&**self).auth_events() + } + + fn redacts(&self) -> Option<&EventId> { + (&**self).redacts() + } + + fn unsigned(&self) -> &BTreeMap { + (&**self).unsigned() + } + + fn hashes(&self) -> &EventHash { + (&**self).hashes() + } + + fn signatures(&self) -> BTreeMap, BTreeMap> { + (&**self).signatures() + } +}