Make Event trait Send+Sync.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -21,7 +21,7 @@ use super::{pdu::Pdu, state_key::StateKey};
|
||||
use crate::{Result, utils};
|
||||
|
||||
/// Abstraction of a PDU so users can have their own PDU types.
|
||||
pub trait Event: Clone + Debug {
|
||||
pub trait Event: Clone + Debug + Send + Sync {
|
||||
/// Serialize into a Ruma JSON format, consuming.
|
||||
#[inline]
|
||||
fn into_format<T>(self) -> T
|
||||
|
||||
@@ -84,7 +84,10 @@ impl Pdu {
|
||||
}
|
||||
}
|
||||
|
||||
impl Event for Pdu {
|
||||
impl Event for Pdu
|
||||
where
|
||||
Self: Send + Sync + 'static,
|
||||
{
|
||||
#[inline]
|
||||
fn auth_events(&self) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_ {
|
||||
self.auth_events.iter().map(AsRef::as_ref)
|
||||
@@ -137,7 +140,10 @@ impl Event for Pdu {
|
||||
fn is_owned(&self) -> bool { true }
|
||||
}
|
||||
|
||||
impl Event for &Pdu {
|
||||
impl Event for &Pdu
|
||||
where
|
||||
Self: Send,
|
||||
{
|
||||
#[inline]
|
||||
fn auth_events(&self) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_ {
|
||||
self.auth_events.iter().map(AsRef::as_ref)
|
||||
|
||||
Reference in New Issue
Block a user