pub trait RoomIdentityProvider: Debug {
// Required methods
fn is_member<'a>(&'a self, user_id: &'a UserId) -> BoxFuture<'a, bool>;
fn member_identities(&self) -> BoxFuture<'_, Vec<UserIdentity>>;
fn user_identity<'a>(
&'a self,
user_id: &'a UserId,
) -> BoxFuture<'a, Option<UserIdentity>>;
// Provided method
fn state_of(&self, user_identity: &UserIdentity) -> IdentityState { ... }
}
Expand description
Something that can answer questions about the membership of a room and the identities of users.
This is implemented by matrix_sdk::Room
and is a trait here so we can
supply a mock when needed.
Required Methods§
Sourcefn is_member<'a>(&'a self, user_id: &'a UserId) -> BoxFuture<'a, bool>
fn is_member<'a>(&'a self, user_id: &'a UserId) -> BoxFuture<'a, bool>
Is the user with the supplied ID a member of this room?
Sourcefn member_identities(&self) -> BoxFuture<'_, Vec<UserIdentity>>
fn member_identities(&self) -> BoxFuture<'_, Vec<UserIdentity>>
Return a list of the UserIdentity
of all members of this room
Sourcefn user_identity<'a>(
&'a self,
user_id: &'a UserId,
) -> BoxFuture<'a, Option<UserIdentity>>
fn user_identity<'a>( &'a self, user_id: &'a UserId, ) -> BoxFuture<'a, Option<UserIdentity>>
Return the UserIdentity
of the user with the supplied ID (even if
they are not a member of this room) or None if this user does not
exist.
Provided Methods§
Sourcefn state_of(&self, user_identity: &UserIdentity) -> IdentityState
fn state_of(&self, user_identity: &UserIdentity) -> IdentityState
Return the IdentityState
of the supplied user identity.
Normally only overridden in tests.