Make all fields owned values and remove event traits.
This commit is contained in:
		
							parent
							
								
									3a26c5ecc6
								
							
						
					
					
						commit
						fd03a1e162
					
				@ -1,44 +1,21 @@
 | 
			
		||||
//! Types for the *m.call.answer* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent};
 | 
			
		||||
use super::{SessionDescription, SessionDescriptionType};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
use super::SessionDescription;
 | 
			
		||||
 | 
			
		||||
/// This event is sent by the callee when they wish to answer the call.
 | 
			
		||||
pub struct AnswerEvent<'a> {
 | 
			
		||||
    content: AnswerEventContent<'a>,
 | 
			
		||||
pub struct AnswerEvent {
 | 
			
		||||
    content: AnswerEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> Event<'a, AnswerEventContent<'a>> for AnswerEvent<'a> {
 | 
			
		||||
    fn content(&'a self) -> &'a AnswerEventContent {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::CallAnswer
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> RoomEvent<'a, AnswerEventContent<'a>> for AnswerEvent<'a> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of an `AnswerEvent`.
 | 
			
		||||
pub struct AnswerEventContent<'a> {
 | 
			
		||||
pub struct AnswerEventContent {
 | 
			
		||||
    /// The VoIP session description.
 | 
			
		||||
    answer: SessionDescription<'a>,
 | 
			
		||||
    answer: SessionDescription,
 | 
			
		||||
    /// The ID of the call this event relates to.
 | 
			
		||||
    call_id: String,
 | 
			
		||||
    /// The version of the VoIP specification this messages adheres to.
 | 
			
		||||
 | 
			
		||||
@ -1,56 +1,33 @@
 | 
			
		||||
//! Types for the *m.call.candidates* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// This event is sent by callers after sending an invite and by the callee after answering.
 | 
			
		||||
/// Its purpose is to give the other party additional ICE candidates to try using to communicate.
 | 
			
		||||
pub struct CandidatesEvent<'a> {
 | 
			
		||||
    content: CandidatesEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> Event<'a, CandidatesEventContent<'a>> for CandidatesEvent<'a> {
 | 
			
		||||
    fn content(&'a self) -> &'a CandidatesEventContent {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::CallCandidates
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> RoomEvent<'a, CandidatesEventContent<'a>> for CandidatesEvent<'a> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
pub struct CandidatesEvent {
 | 
			
		||||
    content: CandidatesEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `CandidatesEvent`.
 | 
			
		||||
pub struct CandidatesEventContent<'a> {
 | 
			
		||||
pub struct CandidatesEventContent {
 | 
			
		||||
    /// The ID of the call this event relates to.
 | 
			
		||||
    call_id: &'a str,
 | 
			
		||||
    call_id: String,
 | 
			
		||||
    /// A list of candidates.
 | 
			
		||||
    candidates: &'a[Candidate<'a>],
 | 
			
		||||
    candidates: Vec<Candidate>,
 | 
			
		||||
    /// The version of the VoIP specification this messages adheres to.
 | 
			
		||||
    version: u64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// An ICE (Interactive Connectivity Establishment) candidate.
 | 
			
		||||
pub struct Candidate<'a> {
 | 
			
		||||
pub struct Candidate {
 | 
			
		||||
    /// The SDP "a" line of the candidate.
 | 
			
		||||
    candidate: &'a str,
 | 
			
		||||
    candidate: String,
 | 
			
		||||
    /// The SDP media type this candidate is intended for.
 | 
			
		||||
    sdp_mid: &'a str,
 | 
			
		||||
    sdp_mid: String,
 | 
			
		||||
    /// The index of the SDP "m" line this candidate is intended for.
 | 
			
		||||
    sdp_m_line_index: u64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,44 +1,21 @@
 | 
			
		||||
//! Types for the *m.call.hangup* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Sent by either party to signal their termination of the call. This can be sent either once the
 | 
			
		||||
/// call has has been established or before to abort the call.
 | 
			
		||||
pub struct HangupEvent<'a> {
 | 
			
		||||
    content: HangupEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> Event<'a, HangupEventContent<'a>> for HangupEvent<'a> {
 | 
			
		||||
    fn content(&'a self) -> &'a HangupEventContent {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::CallHangup
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> RoomEvent<'a, HangupEventContent<'a>> for HangupEvent<'a> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
pub struct HangupEvent {
 | 
			
		||||
    content: HangupEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `HangupEvent`.
 | 
			
		||||
pub struct HangupEventContent<'a> {
 | 
			
		||||
pub struct HangupEventContent {
 | 
			
		||||
    /// The ID of the call this event relates to.
 | 
			
		||||
    call_id: &'a str,
 | 
			
		||||
    call_id: String,
 | 
			
		||||
    /// The version of the VoIP specification this messages adheres to.
 | 
			
		||||
    version: u64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,50 +1,27 @@
 | 
			
		||||
//! Types for the *m.call.invite* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent};
 | 
			
		||||
use super::{SessionDescription, SessionDescriptionType};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
use super::SessionDescription;
 | 
			
		||||
 | 
			
		||||
/// This event is sent by the caller when they wish to establish a call.
 | 
			
		||||
pub struct InviteEvent<'a> {
 | 
			
		||||
    content: InviteEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> Event<'a, InviteEventContent<'a>> for InviteEvent<'a> {
 | 
			
		||||
    fn content(&'a self) -> &'a InviteEventContent {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::CallInvite
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> RoomEvent<'a, InviteEventContent<'a>> for InviteEvent<'a> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
pub struct InviteEvent {
 | 
			
		||||
    content: InviteEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of an `InviteEvent`.
 | 
			
		||||
pub struct InviteEventContent<'a> {
 | 
			
		||||
pub struct InviteEventContent {
 | 
			
		||||
    /// A unique identifer for the call.
 | 
			
		||||
    call_id: &'a str,
 | 
			
		||||
    call_id: String,
 | 
			
		||||
    /// The time in milliseconds that the invite is valid for. Once the invite age exceeds this
 | 
			
		||||
    /// value, clients should discard it. They should also no longer show the call as awaiting an
 | 
			
		||||
    /// answer in the UI.
 | 
			
		||||
    lifetime: u64,
 | 
			
		||||
    /// The session description object.
 | 
			
		||||
    offer: SessionDescription<'a>,
 | 
			
		||||
    offer: SessionDescription,
 | 
			
		||||
    /// The version of the VoIP specification this messages adheres to.
 | 
			
		||||
    version: u64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -8,11 +8,11 @@ pub mod hangup;
 | 
			
		||||
pub mod invite;
 | 
			
		||||
 | 
			
		||||
/// A VoIP session description.
 | 
			
		||||
pub struct SessionDescription<'a> {
 | 
			
		||||
pub struct SessionDescription {
 | 
			
		||||
    /// The type of session description.
 | 
			
		||||
    session_type: SessionDescriptionType,
 | 
			
		||||
    /// The SDP text of the session description.
 | 
			
		||||
    sdp: &'a str,
 | 
			
		||||
    sdp: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The type of VoIP session description.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										61
									
								
								src/core.rs
									
									
									
									
									
								
							
							
						
						
									
										61
									
								
								src/core.rs
									
									
									
									
									
								
							@ -1,5 +1,10 @@
 | 
			
		||||
//! Types for the basic kinds of events.
 | 
			
		||||
 | 
			
		||||
use room::avatar::AvatarEventContent;
 | 
			
		||||
use room::canonical_alias::CanonicalAliasEventContent;
 | 
			
		||||
use room::join_rules::JoinRulesEventContent;
 | 
			
		||||
use room::name::NameEventContent;
 | 
			
		||||
 | 
			
		||||
/// The type of an event.
 | 
			
		||||
pub enum EventType {
 | 
			
		||||
    CallAnswer,
 | 
			
		||||
@ -27,48 +32,22 @@ pub enum EventType {
 | 
			
		||||
    Typing,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Functionality common to all events.
 | 
			
		||||
pub trait Event<'a, T> {
 | 
			
		||||
    /// The primary event payload.
 | 
			
		||||
    fn content(&'a self) -> &'a T;
 | 
			
		||||
    /// The type of event.
 | 
			
		||||
    fn event_type(&self) -> EventType;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// An event emitted within the context of a room.
 | 
			
		||||
pub trait RoomEvent<'a, T>: Event<'a, T> {
 | 
			
		||||
    /// The globally unique event identifier.
 | 
			
		||||
    fn event_id(&'a self) -> &'a str;
 | 
			
		||||
    /// The ID of the room associated with this event.
 | 
			
		||||
    fn room_id(&'a self) -> &'a str;
 | 
			
		||||
    /// The fully-qualified ID of the user who sent the event.
 | 
			
		||||
    fn user_id(&'a self) -> &'a str;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// An event that represents some aspect of a room's state.
 | 
			
		||||
pub trait StateEvent<'a, 'b, T>: RoomEvent<'a, T> {
 | 
			
		||||
    /// Previous content for this aspect of room state.
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b T> {
 | 
			
		||||
        None
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// A unique key which defines the overwriting semantics for this aspect of room state.
 | 
			
		||||
    fn state_key(&self) -> &'a str {
 | 
			
		||||
        ""
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// A stripped-down version of a state event that is included along with some other events.
 | 
			
		||||
pub struct StrippedState<'a, T: 'a> {
 | 
			
		||||
    content: &'a T,
 | 
			
		||||
    state_key: &'a str,
 | 
			
		||||
    event_type: StrippedStateType,
 | 
			
		||||
pub enum StrippedState {
 | 
			
		||||
    RoomAvatar(StrippedRoomAvatar),
 | 
			
		||||
    RoomCanonicalAlias(StrippedRoomCanonicalAlias),
 | 
			
		||||
    RoomJoinRules(StrippedRoomJoinRules),
 | 
			
		||||
    RoomName(StrippedRoomName),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The type of event in a `StrippedState`.
 | 
			
		||||
pub enum StrippedStateType {
 | 
			
		||||
    RoomAvatar,
 | 
			
		||||
    RoomCanonicalAlias,
 | 
			
		||||
    RoomJoinRules,
 | 
			
		||||
    RoomName,
 | 
			
		||||
/// The general form of a `StrippedState`.
 | 
			
		||||
pub struct StrippedStateContent<T> {
 | 
			
		||||
    content: T,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub type StrippedRoomAvatar = StrippedStateContent<AvatarEventContent>;
 | 
			
		||||
pub type StrippedRoomCanonicalAlias = StrippedStateContent<CanonicalAliasEventContent>;
 | 
			
		||||
pub type StrippedRoomJoinRules = StrippedStateContent<JoinRulesEventContent>;
 | 
			
		||||
pub type StrippedRoomName = StrippedStateContent<NameEventContent>;
 | 
			
		||||
 | 
			
		||||
@ -1,29 +1,20 @@
 | 
			
		||||
//! Types for the *m.presence* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Informs the client of a user's presence state change.
 | 
			
		||||
pub struct PresenceEvent<'a> {
 | 
			
		||||
    content: PresenceEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> Event<'a, PresenceEventContent<'a>> for PresenceEvent<'a> {
 | 
			
		||||
    fn content(&'a self) -> &'a PresenceEventContent {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::Presence
 | 
			
		||||
    }
 | 
			
		||||
pub struct PresenceEvent {
 | 
			
		||||
    content: PresenceEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `PresenceEvent`.
 | 
			
		||||
pub struct PresenceEventContent<'a> {
 | 
			
		||||
pub struct PresenceEventContent {
 | 
			
		||||
    /// The current avatar URL for this user.
 | 
			
		||||
    avatar_url: Option<&'a str>,
 | 
			
		||||
    avatar_url: Option<String>,
 | 
			
		||||
    /// The current display name for this user.
 | 
			
		||||
    displayname: Option<&'a str>,
 | 
			
		||||
    displayname: Option<String>,
 | 
			
		||||
    /// The last time since this used performed some action, in milliseconds.
 | 
			
		||||
    last_active_ago: Option<u64>,
 | 
			
		||||
    /// The presence state for this user.
 | 
			
		||||
 | 
			
		||||
@ -2,40 +2,31 @@
 | 
			
		||||
 | 
			
		||||
use std::collections::HashMap;
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Informs the client of new receipts.
 | 
			
		||||
pub struct ReceiptEvent<'a> {
 | 
			
		||||
    content: ReceiptEventContent<'a>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> Event<'a, ReceiptEventContent<'a>> for ReceiptEvent<'a> {
 | 
			
		||||
    fn content(&'a self) -> &'a ReceiptEventContent {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::Receipt
 | 
			
		||||
    }
 | 
			
		||||
pub struct ReceiptEvent {
 | 
			
		||||
    content: ReceiptEventContent,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `ReceiptEvent`.
 | 
			
		||||
///
 | 
			
		||||
/// A mapping of event ID to a collection of receipts for this event ID. The event ID is the ID of
 | 
			
		||||
/// the event being acknowledged and *not* an ID for the receipt itself.
 | 
			
		||||
pub type ReceiptEventContent<'a> = HashMap<&'a str, Receipts<'a>>;
 | 
			
		||||
pub type ReceiptEventContent = HashMap<String, Receipts>;
 | 
			
		||||
 | 
			
		||||
/// A collection of receipts.
 | 
			
		||||
pub struct Receipts<'a> {
 | 
			
		||||
pub struct Receipts {
 | 
			
		||||
    /// A collection of users who have sent *m.read* receipts for this event.
 | 
			
		||||
    m_read: UserReceipts<'a>,
 | 
			
		||||
    m_read: UserReceipts,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// A mapping of user ID to receipt.
 | 
			
		||||
///
 | 
			
		||||
/// The user ID is the entity who sent this receipt.
 | 
			
		||||
pub type UserReceipts<'a> = HashMap<&'a str, Receipt>;
 | 
			
		||||
pub type UserReceipts = HashMap<String, Receipt>;
 | 
			
		||||
 | 
			
		||||
/// An acknowledgement of an event.
 | 
			
		||||
pub struct Receipt {
 | 
			
		||||
 | 
			
		||||
@ -1,57 +1,21 @@
 | 
			
		||||
//! Types for the *m.room.aliases* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Informs the room about what room aliases it has been given.
 | 
			
		||||
pub struct AliasesEvent<'a, 'b> {
 | 
			
		||||
    content: AliasesEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<AliasesEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
pub struct AliasesEvent {
 | 
			
		||||
    content: AliasesEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<AliasesEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    /// The homeserver domain which owns these room aliases.
 | 
			
		||||
    state_key: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, AliasesEventContent<'a>> for AliasesEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a AliasesEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomAliases
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, AliasesEventContent<'a>> for AliasesEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, AliasesEventContent<'a>> for AliasesEvent<'a, 'b> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b AliasesEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn state_key(&self) -> &'a str {
 | 
			
		||||
        &self.state_key
 | 
			
		||||
    }
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of an `AliasesEvent`.
 | 
			
		||||
pub struct AliasesEventContent<'a> {
 | 
			
		||||
pub struct AliasesEventContent {
 | 
			
		||||
    /// A list of room aliases.
 | 
			
		||||
    aliases: &'a[&'a str],
 | 
			
		||||
    aliases: Vec<String>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,59 +1,25 @@
 | 
			
		||||
//! Types for the *m.room.avatar* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
use super::ImageInfo;
 | 
			
		||||
 | 
			
		||||
/// A picture that is associated with the room.
 | 
			
		||||
///
 | 
			
		||||
/// This can be displayed alongside the room information.
 | 
			
		||||
pub struct AvatarEvent<'a, 'b> {
 | 
			
		||||
    content: AvatarEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<AvatarEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
pub struct AvatarEvent {
 | 
			
		||||
    content: AvatarEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<AvatarEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, AvatarEventContent<'a>> for AvatarEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a AvatarEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomAvatar
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, AvatarEventContent<'a>> for AvatarEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, AvatarEventContent<'a>> for AvatarEvent<'a, 'b> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b AvatarEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn state_key(&self) -> &'a str {
 | 
			
		||||
        ""
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
/// The payload of an `AvatarEvent`.
 | 
			
		||||
pub struct AvatarEventContent<'a> {
 | 
			
		||||
    info: &'a ImageInfo<'a>,
 | 
			
		||||
    thumbnail_info: &'a ImageInfo<'a>,
 | 
			
		||||
    thumbnail_url: &'a str,
 | 
			
		||||
    url: &'a str,
 | 
			
		||||
pub struct AvatarEventContent {
 | 
			
		||||
    info: ImageInfo,
 | 
			
		||||
    thumbnail_info: ImageInfo,
 | 
			
		||||
    thumbnail_url: String,
 | 
			
		||||
    url: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,52 +1,20 @@
 | 
			
		||||
//! Types for the *m.room.canonical_alias* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Informs the room as to which alias is the canonical one.
 | 
			
		||||
pub struct CanonicalAliasEvent<'a, 'b> {
 | 
			
		||||
    content: CanonicalAliasEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<CanonicalAliasEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, CanonicalAliasEventContent<'a>> for CanonicalAliasEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a CanonicalAliasEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomCanonicalAlias
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, CanonicalAliasEventContent<'a>> for CanonicalAliasEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, CanonicalAliasEventContent<'a>> for CanonicalAliasEvent<'a, 'b> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b CanonicalAliasEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
pub struct CanonicalAliasEvent {
 | 
			
		||||
    content: CanonicalAliasEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<CanonicalAliasEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `CanonicalAliasEvent`.
 | 
			
		||||
pub struct CanonicalAliasEventContent<'a> {
 | 
			
		||||
pub struct CanonicalAliasEventContent {
 | 
			
		||||
    /// The canonical alias.
 | 
			
		||||
    alias: &'a str,
 | 
			
		||||
    alias: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,46 +1,21 @@
 | 
			
		||||
//! Types for the *m.room.create* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// This is the first event in a room and cannot be changed. It acts as the root of all other
 | 
			
		||||
/// events.
 | 
			
		||||
pub struct CreateEvent<'a, 'b> {
 | 
			
		||||
    content: CreateEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<CreateEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
pub struct CreateEvent {
 | 
			
		||||
    content: CreateEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<CreateEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, CreateEventContent<'a>> for CreateEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a CreateEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomCreate
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, CreateEventContent<'a>> for CreateEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, CreateEventContent<'a>> for CreateEvent<'a, 'b> {}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `CreateEvent`.
 | 
			
		||||
pub struct CreateEventContent<'a> {
 | 
			
		||||
pub struct CreateEventContent {
 | 
			
		||||
    /// The `user_id` of the room creator. This is set by the homeserver.
 | 
			
		||||
    creator: &'a str,
 | 
			
		||||
    creator: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,59 +1,24 @@
 | 
			
		||||
//! Types for the *m.room.guest_access* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Controls whether guest users are allowed to join rooms.
 | 
			
		||||
///
 | 
			
		||||
/// This event controls whether guest users are allowed to join rooms. If this event is absent,
 | 
			
		||||
/// servers should act as if it is present and has the value `GuestAccess::Forbidden`.
 | 
			
		||||
pub struct GuestAccessEvent<'a, 'b> {
 | 
			
		||||
    content: GuestAccessEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<GuestAccessEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, GuestAccessEventContent<'a>> for GuestAccessEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a GuestAccessEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomGuestAccess
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, GuestAccessEventContent<'a>> for GuestAccessEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, GuestAccessEventContent<'a>> for GuestAccessEvent<'a, 'b> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b GuestAccessEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn state_key(&self) -> &'a str {
 | 
			
		||||
        ""
 | 
			
		||||
    }
 | 
			
		||||
pub struct GuestAccessEvent {
 | 
			
		||||
    content: GuestAccessEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<GuestAccessEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `GuestAccessEvent`.
 | 
			
		||||
pub struct GuestAccessEventContent<'a> {
 | 
			
		||||
    guest_access: &'a GuestAccess,
 | 
			
		||||
pub struct GuestAccessEventContent {
 | 
			
		||||
    guest_access: GuestAccess,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// A policy for guest user access to a room.
 | 
			
		||||
 | 
			
		||||
@ -1,56 +1,23 @@
 | 
			
		||||
//! Types for the *m.room.history_visibility* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// This event controls whether a member of a room can see the events that happened in a room from
 | 
			
		||||
/// before they joined.
 | 
			
		||||
pub struct HistoryVisibilityEvent<'a, 'b> {
 | 
			
		||||
    content: HistoryVisibilityEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<HistoryVisibilityEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, HistoryVisibilityEventContent<'a>> for HistoryVisibilityEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a HistoryVisibilityEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomHistoryVisibility
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, HistoryVisibilityEventContent<'a>> for HistoryVisibilityEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, HistoryVisibilityEventContent<'a>>
 | 
			
		||||
    for HistoryVisibilityEvent<'a, 'b>
 | 
			
		||||
{
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b HistoryVisibilityEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
pub struct HistoryVisibilityEvent {
 | 
			
		||||
    content: HistoryVisibilityEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<HistoryVisibilityEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `HistoryVisibilityEvent`.
 | 
			
		||||
pub struct HistoryVisibilityEventContent<'a> {
 | 
			
		||||
pub struct HistoryVisibilityEventContent {
 | 
			
		||||
    /// Who can see the room history.
 | 
			
		||||
    history_visibility: &'a HistoryVisibility,
 | 
			
		||||
    history_visibility: HistoryVisibility,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Who can see a room's history.
 | 
			
		||||
@ -70,4 +37,3 @@ pub enum HistoryVisibility {
 | 
			
		||||
    /// participating homeserver with anyone, regardless of whether they have ever joined the room.
 | 
			
		||||
    WorldReadable,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,57 +1,26 @@
 | 
			
		||||
//! Types for the *m.room.join_rules* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Describes how users are allowed to join the room.
 | 
			
		||||
pub struct JoinRulesEvent<'a, 'b> {
 | 
			
		||||
    content: JoinRulesEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<JoinRulesEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, JoinRulesEventContent<'a>> for JoinRulesEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a JoinRulesEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomJoinRules
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, JoinRulesEventContent<'a>> for JoinRulesEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, JoinRulesEventContent<'a>> for JoinRulesEvent<'a, 'b> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b JoinRulesEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
pub struct JoinRulesEvent {
 | 
			
		||||
    content: JoinRulesEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<JoinRulesEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `JoinRulesEvent`.
 | 
			
		||||
pub struct JoinRulesEventContent<'a> {
 | 
			
		||||
pub struct JoinRulesEventContent {
 | 
			
		||||
    /// The type of rules used for users wishing to join this room.
 | 
			
		||||
    join_rule: &'a JoinRules,
 | 
			
		||||
    join_rule: JoinRule,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The rule used for users wishing to join this room.
 | 
			
		||||
pub enum JoinRules {
 | 
			
		||||
pub enum JoinRule {
 | 
			
		||||
    /// A user who wishes to join the room must first receive an invite to the room from someone
 | 
			
		||||
    /// already inside of the room.
 | 
			
		||||
    Invite,
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
use std::collections::HashMap;
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent, StrippedState, StrippedStateType};
 | 
			
		||||
use core::{EventType, StrippedState};
 | 
			
		||||
 | 
			
		||||
/// The current membership state of a user in the room.
 | 
			
		||||
///
 | 
			
		||||
@ -17,57 +17,21 @@ use core::{Event, EventType, RoomEvent, StateEvent, StrippedState, StrippedState
 | 
			
		||||
/// This event may also include an *invite_room_state* key outside the *content* key. If present,
 | 
			
		||||
/// this contains an array of `StrippedState` events. These events provide information on a few
 | 
			
		||||
/// select state events such as the room name.
 | 
			
		||||
pub struct MemberEvent<'a, 'b, T: 'a> {
 | 
			
		||||
    content: MemberEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    invite_room_state: Option<&'a[&'a StrippedState<'a, T>]>,
 | 
			
		||||
    prev_content: Option<MemberEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    state_key: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b, T> Event<'a, MemberEventContent<'a>> for MemberEvent<'a, 'b, T> {
 | 
			
		||||
    fn content(&'a self) -> &'a MemberEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomMember
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b, T> RoomEvent<'a, MemberEventContent<'a>> for MemberEvent<'a, 'b, T> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b, T> StateEvent<'a, 'b, MemberEventContent<'a>> for MemberEvent<'a, 'b, T> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b MemberEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn state_key(&self) -> &'a str {
 | 
			
		||||
        &self.state_key
 | 
			
		||||
    }
 | 
			
		||||
pub struct MemberEvent {
 | 
			
		||||
    content: MemberEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    invite_room_state: Option<Vec<StrippedState>>,
 | 
			
		||||
    prev_content: Option<MemberEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `MemberEvent`.
 | 
			
		||||
pub struct MemberEventContent<'a> {
 | 
			
		||||
    avatar_url: Option<&'a str>,
 | 
			
		||||
    displayname: Option<&'a str>,
 | 
			
		||||
pub struct MemberEventContent {
 | 
			
		||||
    avatar_url: Option<String>,
 | 
			
		||||
    displayname: Option<String>,
 | 
			
		||||
    membership: MembershipState,
 | 
			
		||||
    third_party_invite: (), // TODO
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -18,9 +18,9 @@ pub mod third_party_invite;
 | 
			
		||||
pub mod topic;
 | 
			
		||||
 | 
			
		||||
/// Metadata about an image.
 | 
			
		||||
pub struct ImageInfo<'a> {
 | 
			
		||||
pub struct ImageInfo {
 | 
			
		||||
    height: u64,
 | 
			
		||||
    mimetype: &'a str,
 | 
			
		||||
    mimetype: String,
 | 
			
		||||
    size: u64,
 | 
			
		||||
    width: u64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,51 +1,20 @@
 | 
			
		||||
//! Types for the *m.room.name* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// A human-friendly room name designed to be displayed to the end-user.
 | 
			
		||||
pub struct NameEvent<'a, 'b> {
 | 
			
		||||
    content: NameEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<NameEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, NameEventContent<'a>> for NameEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a NameEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomName
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, NameEventContent<'a>> for NameEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, NameEventContent<'a>> for NameEvent<'a, 'b> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b NameEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
pub struct NameEvent {
 | 
			
		||||
    content: NameEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<NameEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `NameEvent`.
 | 
			
		||||
pub struct NameEventContent<'a> {
 | 
			
		||||
pub struct NameEventContent {
 | 
			
		||||
    /// The name of the room. This MUST NOT exceed 255 bytes.
 | 
			
		||||
    name: &'a str,
 | 
			
		||||
    name: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -2,58 +2,27 @@
 | 
			
		||||
 | 
			
		||||
use std::collections::HashMap;
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Defines the power levels (privileges) of users in the room.
 | 
			
		||||
pub struct PowerLevelsEvent<'a, 'b> {
 | 
			
		||||
    content: PowerLevelsEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<PowerLevelsEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, PowerLevelsEventContent<'a>> for PowerLevelsEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a PowerLevelsEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomPowerLevels
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, PowerLevelsEventContent<'a>> for PowerLevelsEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, PowerLevelsEventContent<'a>> for PowerLevelsEvent<'a, 'b> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b PowerLevelsEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
pub struct PowerLevelsEvent {
 | 
			
		||||
    content: PowerLevelsEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<PowerLevelsEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `PowerLevelsEvent`.
 | 
			
		||||
pub struct PowerLevelsEventContent<'a> {
 | 
			
		||||
pub struct PowerLevelsEventContent {
 | 
			
		||||
    ban: u64,
 | 
			
		||||
    events: &'a HashMap<&'a str, u64>,
 | 
			
		||||
    events: HashMap<String, u64>,
 | 
			
		||||
    events_default: u64,
 | 
			
		||||
    kick: u64,
 | 
			
		||||
    redact: u64,
 | 
			
		||||
    state_default: u64,
 | 
			
		||||
    users: &'a HashMap<&'a str, u64>,
 | 
			
		||||
    users: HashMap<String, u64>,
 | 
			
		||||
    users_default: u64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,43 +1,20 @@
 | 
			
		||||
//! Types for the *m.room.avatar* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// A redaction of an event.
 | 
			
		||||
pub struct RedactionEvent<'a> {
 | 
			
		||||
    content: RedactionEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
pub struct RedactionEvent {
 | 
			
		||||
    content: RedactionEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    /// The ID of the event that was redacted.
 | 
			
		||||
    redacts: &'a str,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, RedactionEventContent<'a>> for RedactionEvent<'a> {
 | 
			
		||||
    fn content(&'a self) -> &'a RedactionEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomRedaction
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> RoomEvent<'a, RedactionEventContent<'a>> for RedactionEvent<'a> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
    redacts: String,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `RedactionEvent`.
 | 
			
		||||
pub struct RedactionEventContent<'a> {
 | 
			
		||||
pub struct RedactionEventContent {
 | 
			
		||||
    /// The reason for the redaction, if any.
 | 
			
		||||
    reason: Option<&'a str>,
 | 
			
		||||
    reason: Option<String>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,61 +1,25 @@
 | 
			
		||||
//! Types for the *m.room.third_party_invite* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// An invitation to a room issued to a third party identifier, rather than a matrix user ID.
 | 
			
		||||
///
 | 
			
		||||
/// Acts as an *m.room.member* invite event, where there isn't a target user_id to invite. This
 | 
			
		||||
/// event contains a token and a public key whose private key must be used to sign the token. Any
 | 
			
		||||
/// user who can present that signature may use this invitation to join the target room.
 | 
			
		||||
pub struct ThirdPartyInviteEvent<'a, 'b> {
 | 
			
		||||
    content: ThirdPartyInviteEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<ThirdPartyInviteEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    state_key: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, ThirdPartyInviteEventContent<'a>> for ThirdPartyInviteEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a ThirdPartyInviteEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomThirdPartyInvite
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, ThirdPartyInviteEventContent<'a>> for ThirdPartyInviteEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, ThirdPartyInviteEventContent<'a>> for ThirdPartyInviteEvent<'a, 'b> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b ThirdPartyInviteEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn state_key(&self) -> &'a str {
 | 
			
		||||
        &self.state_key
 | 
			
		||||
    }
 | 
			
		||||
pub struct ThirdPartyInviteEvent {
 | 
			
		||||
    content: ThirdPartyInviteEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<ThirdPartyInviteEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `ThirdPartyInviteEvent`.
 | 
			
		||||
pub struct ThirdPartyInviteEventContent<'a> {
 | 
			
		||||
    display_name: &'a str,
 | 
			
		||||
    key_validity_url: &'a str,
 | 
			
		||||
    public_key: &'a str,
 | 
			
		||||
pub struct ThirdPartyInviteEventContent {
 | 
			
		||||
    display_name: String,
 | 
			
		||||
    key_validity_url: String,
 | 
			
		||||
    public_key: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,51 +1,20 @@
 | 
			
		||||
//! Types for the *m.room.topic* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType, RoomEvent, StateEvent};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// A topic is a short message detailing what is currently being discussed in the room.
 | 
			
		||||
pub struct TopicEvent<'a, 'b> {
 | 
			
		||||
    content: TopicEventContent<'a>,
 | 
			
		||||
    event_id: &'a str,
 | 
			
		||||
    prev_content: Option<TopicEventContent<'b>>,
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
    user_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> Event<'a, TopicEventContent<'a>> for TopicEvent<'a, 'b> {
 | 
			
		||||
    fn content(&'a self) -> &'a TopicEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::RoomTopic
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> RoomEvent<'a, TopicEventContent<'a>> for TopicEvent<'a, 'b> {
 | 
			
		||||
    fn event_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.event_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn room_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.room_id
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn user_id(&'a self) -> &'a str {
 | 
			
		||||
        &self.user_id
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, 'b> StateEvent<'a, 'b, TopicEventContent<'a>> for TopicEvent<'a, 'b> {
 | 
			
		||||
    fn prev_content(&'a self) -> Option<&'b TopicEventContent> {
 | 
			
		||||
        match self.prev_content {
 | 
			
		||||
            Some(ref prev_content) => Some(prev_content),
 | 
			
		||||
            None => None,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
pub struct TopicEvent {
 | 
			
		||||
    content: TopicEventContent,
 | 
			
		||||
    event_id: String,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    prev_content: Option<TopicEventContent>,
 | 
			
		||||
    room_id: String,
 | 
			
		||||
    state_key: String,
 | 
			
		||||
    user_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `TopicEvent`.
 | 
			
		||||
pub struct TopicEventContent<'a> {
 | 
			
		||||
pub struct TopicEventContent {
 | 
			
		||||
    /// The topic text.
 | 
			
		||||
    topic: &'a str,
 | 
			
		||||
    topic: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								src/tag.rs
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								src/tag.rs
									
									
									
									
									
								
							@ -2,29 +2,21 @@
 | 
			
		||||
 | 
			
		||||
use std::collections::HashMap;
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Informs the client of tags on a room.
 | 
			
		||||
pub struct TagEvent<'a> {
 | 
			
		||||
pub struct TagEvent {
 | 
			
		||||
    /// The payload.
 | 
			
		||||
    content: TagEventContent<'a>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> Event<'a, TagEventContent<'a>> for TagEvent<'a> {
 | 
			
		||||
    fn content(&'a self) -> &'a TagEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::Tag
 | 
			
		||||
    }
 | 
			
		||||
    content: TagEventContent,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `TagEvent`.
 | 
			
		||||
pub struct TagEventContent<'a> {
 | 
			
		||||
    /// The list of user IDs typing in this room, if any.
 | 
			
		||||
    tags: &'a Tags<'a>,
 | 
			
		||||
pub struct TagEventContent {
 | 
			
		||||
    /// A map of tag names to tag info.
 | 
			
		||||
    tags: HashMap<String, TagInfo>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// A map of tag names to values.
 | 
			
		||||
pub type Tags<'a> = HashMap<&'a str, &'a str>;
 | 
			
		||||
/// Information about a tag.
 | 
			
		||||
pub struct TagInfo {
 | 
			
		||||
    order: Option<u64>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,27 +1,18 @@
 | 
			
		||||
//! Types for the *m.typing* event.
 | 
			
		||||
 | 
			
		||||
use core::{Event, EventType};
 | 
			
		||||
use core::EventType;
 | 
			
		||||
 | 
			
		||||
/// Informs the client of the list of users currently typing.
 | 
			
		||||
pub struct TypingEvent<'a> {
 | 
			
		||||
pub struct TypingEvent {
 | 
			
		||||
    /// The payload.
 | 
			
		||||
    content: TypingEventContent<'a>,
 | 
			
		||||
    content: TypingEventContent,
 | 
			
		||||
    event_type: EventType,
 | 
			
		||||
    /// The ID of the room associated with this event.
 | 
			
		||||
    room_id: &'a str,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> Event<'a, TypingEventContent<'a>> for TypingEvent<'a> {
 | 
			
		||||
    fn content(&'a self) -> &'a TypingEventContent<'a> {
 | 
			
		||||
        &self.content
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn event_type(&self) -> EventType {
 | 
			
		||||
        EventType::Typing
 | 
			
		||||
    }
 | 
			
		||||
    room_id: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// The payload of a `TypingEvent`.
 | 
			
		||||
pub struct TypingEventContent<'a> {
 | 
			
		||||
pub struct TypingEventContent {
 | 
			
		||||
    /// The list of user IDs typing in this room, if any.
 | 
			
		||||
    user_ids: &'a[&'a str],
 | 
			
		||||
    user_ids: Vec<String>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user