matrix_sdk_base: expose RoomMember

master
Dominique Martinet 2020-10-07 14:23:15 +02:00
parent bc48674f9f
commit f7039d9a8d
2 changed files with 9 additions and 1 deletions

View File

@ -53,7 +53,7 @@ mod state;
pub use client::{BaseClient, BaseClientConfig, RoomState, RoomStateType}; pub use client::{BaseClient, BaseClientConfig, RoomState, RoomStateType};
pub use event_emitter::{CustomEvent, EventEmitter, SyncRoom}; pub use event_emitter::{CustomEvent, EventEmitter, SyncRoom};
pub use models::Room; pub use models::{Room, RoomMember};
pub use state::{AllRooms, ClientState}; pub use state::{AllRooms, ClientState};
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]

View File

@ -83,6 +83,14 @@ impl PartialEq for RoomMember {
} }
impl RoomMember { impl RoomMember {
/// Create a new room member.
///
/// # Arguments
///
/// * `event` - event associated with a member joining, leaving or getting
/// invited to a room.
///
/// * `room_id` - The unique id of the room this member is part of.
pub fn new(event: &SyncStateEvent<MemberEventContent>, room_id: &RoomId) -> Self { pub fn new(event: &SyncStateEvent<MemberEventContent>, room_id: &RoomId) -> Self {
Self { Self {
name: event.state_key.clone(), name: event.state_key.clone(),