Remove EventKind trait.
This commit is contained in:
parent
05ae55abea
commit
b0b7a3e6ea
10
src/lib.rs
10
src/lib.rs
@ -30,12 +30,6 @@ pub struct Event<T> where T: Deserialize + Serialize {
|
||||
pub extra_content: Option<Value>,
|
||||
}
|
||||
|
||||
/// A type that represents a kind of Matrix event.
|
||||
///
|
||||
/// The event kinds are basic events, room events, and state events.
|
||||
/// This trait can be useful to constrain a generic parameter that must be a Matrix event.
|
||||
pub trait EventKind: Deserialize + Serialize {}
|
||||
|
||||
/// The type of an event.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum EventType {
|
||||
@ -119,10 +113,6 @@ pub struct StateEvent<T> where T: Deserialize + Serialize {
|
||||
pub user_id: String,
|
||||
}
|
||||
|
||||
impl<T> EventKind for Event<T> where T: Deserialize + Serialize {}
|
||||
impl<T> EventKind for RoomEvent<T> where T: Deserialize + Serialize {}
|
||||
impl<T> EventKind for StateEvent<T> where T: Deserialize + Serialize {}
|
||||
|
||||
impl Display for EventType {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
|
||||
let event_type_str = match *self {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.presence* event.
|
||||
|
||||
use {EventKind, EventType};
|
||||
use EventType;
|
||||
|
||||
/// Informs the client of a user's presence state change.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
@ -38,5 +38,3 @@ pub enum PresenceState {
|
||||
/// Connected to the service but not available for chat.
|
||||
Unavailable,
|
||||
}
|
||||
|
||||
impl EventKind for PresenceEvent {}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use {EventKind, EventType};
|
||||
use EventType;
|
||||
|
||||
/// Informs the client of new receipts.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
@ -37,5 +37,3 @@ pub struct Receipt {
|
||||
/// The timestamp the receipt was sent at.
|
||||
pub ts: u64,
|
||||
}
|
||||
|
||||
impl EventKind for ReceiptEvent {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.typing* event.
|
||||
|
||||
use {EventKind, EventType};
|
||||
use EventType;
|
||||
|
||||
/// Informs the client of the list of users currently typing.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
@ -19,5 +19,3 @@ pub struct TypingEventContent {
|
||||
/// The list of user IDs typing in this room, if any.
|
||||
pub user_ids: Vec<String>,
|
||||
}
|
||||
|
||||
impl EventKind for TypingEvent {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user