pub struct Service {
services: Arc<OnceServices>,
}Expand description
Resolves room state and answers state-based authorization questions.
Accessors share the state, timeline, short-ID, and membership services so callers use one interpretation of current and historical room state.
Fields§
§services: Arc<OnceServices>Implementations§
Source§impl Service
impl Service
Sourcepub async fn erased_for_server(
&self,
origin: &ServerName,
pdu: CanonicalJsonObject,
) -> CanonicalJsonObject
pub async fn erased_for_server( &self, origin: &ServerName, pdu: CanonicalJsonObject, ) -> CanonicalJsonObject
Applies MSC4025 pruning to an event served over federation.
The event is pruned when its sender is erased and origin had no joined
user at the event. This check composes with history visibility rather than
replacing it, and unresolved redaction inputs leave the event intact.
Source§impl Service
impl Service
Sourcepub async fn erased_view(&self, user_id: &UserId, pdu: &Pdu) -> Option<Pdu>
pub async fn erased_view(&self, user_id: &UserId, pdu: &Pdu) -> Option<Pdu>
MSC4025: the pruned clone of pdu for recipient user_id, or None to
serve the original.
A prune that cannot read the room version’s redaction rules also yields
None, so an unprunable event is served intact rather than withheld.
Source§impl Service
impl Service
Sourcepub async fn erased_for(&self, user_id: &UserId, pdu: &Pdu) -> bool
pub async fn erased_for(&self, user_id: &UserId, pdu: &Pdu) -> bool
MSC4025: whether pdu serves pruned to user_id: its sender is erased
and the recipient was not joined in the room state at the event.
The erasure check runs first and alone: it is a point get that is almost always false, while the membership read is a state lookup that only an erased sender needs.
Source§impl Service
impl Service
Sourcepub async fn room_state_get_content<T>(
&self,
room_id: &RoomId,
event_type: &StateEventType,
state_key: &str,
) -> Result<T>where
T: for<'de> Deserialize<'de> + Send,
pub async fn room_state_get_content<T>(
&self,
room_id: &RoomId,
event_type: &StateEventType,
state_key: &str,
) -> Result<T>where
T: for<'de> Deserialize<'de> + Send,
Deserializes one current state event’s content.
The event is selected by (event_type, state_key). Snapshot lookup,
timeline lookup, and content errors are returned to the caller.
Source§impl Service
impl Service
Sourcepub fn room_state_type_pdus<'a>(
&'a self,
room_id: &'a RoomId,
event_type: &'a StateEventType,
) -> impl Stream<Item = Result<impl Event>> + Send + 'a
pub fn room_state_type_pdus<'a>( &'a self, room_id: &'a RoomId, event_type: &'a StateEventType, ) -> impl Stream<Item = Result<impl Event>> + Send + 'a
Streams current state events of one type.
Failure to resolve the room’s current snapshot is yielded as an error. Missing reverse mappings and unavailable PDUs are skipped by the delegated best-effort stream.
Source§impl Service
impl Service
Sourcepub fn room_state_full<'a>(
&'a self,
room_id: &'a RoomId,
) -> impl Stream<Item = Result<((StateEventType, StateKey), impl Event)>> + Send + 'a
pub fn room_state_full<'a>( &'a self, room_id: &'a RoomId, ) -> impl Stream<Item = Result<((StateEventType, StateKey), impl Event)>> + Send + 'a
Streams the room’s full current state with type and state keys.
Failure to resolve the current snapshot is yielded as an error. Entries whose IDs, PDUs, or state keys cannot be resolved are skipped.
Source§impl Service
impl Service
Sourcepub fn room_state_full_pdus<'a>(
&'a self,
room_id: &'a RoomId,
) -> impl Stream<Item = Result<impl Event>> + Send + 'a
pub fn room_state_full_pdus<'a>( &'a self, room_id: &'a RoomId, ) -> impl Stream<Item = Result<impl Event>> + Send + 'a
Streams every resolvable PDU in the room’s current state.
Failure to resolve the current snapshot is yielded as an error. Individual state entries with missing reverse mappings or PDUs are skipped.
Source§impl Service
impl Service
Sourcepub async fn room_state_get_id(
&self,
room_id: &RoomId,
event_type: &StateEventType,
state_key: &str,
) -> Result<OwnedEventId>
pub async fn room_state_get_id( &self, room_id: &RoomId, event_type: &StateEventType, state_key: &str, ) -> Result<OwnedEventId>
Returns the event ID for one current state tuple.
The room’s current snapshot must exist, and both short-ID mappings must
resolve for (event_type, state_key).
Source§impl Service
impl Service
Sourcepub fn room_state_keys_with_ids<'a>(
&'a self,
room_id: &'a RoomId,
event_type: &'a StateEventType,
) -> impl Stream<Item = Result<(StateKey, OwnedEventId)>> + Send + 'a
pub fn room_state_keys_with_ids<'a>( &'a self, room_id: &'a RoomId, event_type: &'a StateEventType, ) -> impl Stream<Item = Result<(StateKey, OwnedEventId)>> + Send + 'a
Streams state keys and event IDs for one current state event type.
Failure to resolve the current snapshot is yielded as an error. Individual short-ID mapping failures are omitted by the best-effort inner stream.
Source§impl Service
impl Service
Sourcepub fn room_state_keys<'a>(
&'a self,
room_id: &'a RoomId,
event_type: &'a StateEventType,
) -> impl Stream<Item = Result<StateKey>> + Send + 'a
pub fn room_state_keys<'a>( &'a self, room_id: &'a RoomId, event_type: &'a StateEventType, ) -> impl Stream<Item = Result<StateKey>> + Send + 'a
Streams state keys for one current state event type.
Failure to resolve the current snapshot is yielded as an error. Individual state-key mapping failures are omitted by the best-effort inner stream.
Source§impl Service
impl Service
Sourcepub async fn room_state_get(
&self,
room_id: &RoomId,
event_type: &StateEventType,
state_key: &str,
) -> Result<Pdu>
pub async fn room_state_get( &self, room_id: &RoomId, event_type: &StateEventType, state_key: &str, ) -> Result<Pdu>
Returns one current state PDU.
The event is selected by (event_type, state_key). Snapshot, short-ID, and
timeline lookup failures are returned to the caller.
Source§impl Service
impl Service
Sourcepub async fn server_can_see_event(
&self,
origin: &ServerName,
room_id: &RoomId,
event_id: &EventId,
) -> bool
pub async fn server_can_see_event( &self, origin: &ServerName, room_id: &RoomId, event_id: &EventId, ) -> bool
Reports whether a server may see an event over federation.
Missing event state is allowed, and missing or invalid history visibility
defaults to shared. For invited and joined, a currently joined user
from the origin must also hold the required membership at the event.
Source§impl Service
impl Service
Sourcepub async fn server_joined_at_pdu(
&self,
origin: &ServerName,
event_id: &EventId,
) -> bool
pub async fn server_joined_at_pdu( &self, origin: &ServerName, event_id: &EventId, ) -> bool
Reports whether any user from an origin was joined at an event.
This MSC4025 helper scans membership state at the event and denies when the snapshot cannot be resolved. Invalid user state keys are skipped.
Source§impl Service
impl Service
Sourcepub async fn user_was_joined(
&self,
shortstatehash: ShortStateHash,
user_id: &UserId,
) -> bool
pub async fn user_was_joined( &self, shortstatehash: ShortStateHash, user_id: &UserId, ) -> bool
Reports whether a user was joined in a selected state snapshot.
Missing or invalid membership state is treated as leave, so lookup errors
return false.
Source§impl Service
impl Service
Sourcepub async fn user_was_invited(
&self,
shortstatehash: ShortStateHash,
user_id: &UserId,
) -> bool
pub async fn user_was_invited( &self, shortstatehash: ShortStateHash, user_id: &UserId, ) -> bool
Reports whether a user was invited or joined in a selected state snapshot.
Missing or invalid membership state is treated as leave, so lookup errors
return false.
Source§impl Service
impl Service
Sourcepub async fn user_membership(
&self,
shortstatehash: ShortStateHash,
user_id: &UserId,
) -> MembershipState
pub async fn user_membership( &self, shortstatehash: ShortStateHash, user_id: &UserId, ) -> MembershipState
Returns a user’s membership in a selected state snapshot.
Missing state, unavailable events, and invalid membership content all fall
back to [MembershipState::Leave].
Source§impl Service
impl Service
Sourcepub async fn user_membership_at_pdu(
&self,
user_id: &UserId,
pdu: &Pdu,
) -> MembershipState
pub async fn user_membership_at_pdu( &self, user_id: &UserId, pdu: &Pdu, ) -> MembershipState
MSC4115: the user’s room membership “just after” the given PDU landed.
pdu_shortstatehash returns state-before-the-event, so a member event
targeting user_id overrides that lookup with its own content. Missing or
invalid state falls back to [MembershipState::Leave].
Source§impl Service
impl Service
Sourcepub async fn state_get_content<T>(
&self,
shortstatehash: ShortStateHash,
event_type: &StateEventType,
state_key: &str,
) -> Result<T>where
T: for<'de> Deserialize<'de> + Send,
pub async fn state_get_content<T>(
&self,
shortstatehash: ShortStateHash,
event_type: &StateEventType,
state_key: &str,
) -> Result<T>where
T: for<'de> Deserialize<'de> + Send,
Deserializes one event’s content from a selected state snapshot.
The event is selected by (event_type, state_key). State, short-ID,
timeline, and content errors are returned to the caller.
Source§impl Service
impl Service
Sourcepub async fn state_contains(
&self,
shortstatehash: ShortStateHash,
event_type: &StateEventType,
state_key: &str,
) -> bool
pub async fn state_contains( &self, shortstatehash: ShortStateHash, event_type: &StateEventType, state_key: &str, ) -> bool
Reports whether a state snapshot contains one state tuple.
Failure to resolve the tuple’s short state key or load the snapshot is treated as absence.
Source§impl Service
impl Service
Sourcepub async fn state_contains_type(
&self,
shortstatehash: ShortStateHash,
event_type: &StateEventType,
) -> bool
pub async fn state_contains_type( &self, shortstatehash: ShortStateHash, event_type: &StateEventType, ) -> bool
Reports whether a state snapshot contains any event of one type.
Snapshot and state-key mapping errors are omitted by the underlying
best-effort stream and can therefore produce false.
Source§impl Service
impl Service
Sourcepub async fn state_contains_shortstatekey(
&self,
shortstatehash: ShortStateHash,
shortstatekey: ShortStateKey,
) -> bool
pub async fn state_contains_shortstatekey( &self, shortstatehash: ShortStateHash, shortstatekey: ShortStateKey, ) -> bool
Reports whether a snapshot contains a short state key.
The compressed snapshot is searched across every short event ID for the key. Failure to load the snapshot is treated as absence.
Source§impl Service
impl Service
Sourcepub async fn state_get_id(
&self,
shortstatehash: ShortStateHash,
event_type: &StateEventType,
state_key: &str,
) -> Result<OwnedEventId>
pub async fn state_get_id( &self, shortstatehash: ShortStateHash, event_type: &StateEventType, state_key: &str, ) -> Result<OwnedEventId>
Returns one event ID from a selected state snapshot.
Both the state tuple’s short key and its short event ID must resolve.
Source§impl Service
impl Service
Sourcepub async fn state_get_shortid(
&self,
shortstatehash: ShortStateHash,
event_type: &StateEventType,
state_key: &str,
) -> Result<ShortEventId>
pub async fn state_get_shortid( &self, shortstatehash: ShortStateHash, event_type: &StateEventType, state_key: &str, ) -> Result<ShortEventId>
Returns one short event ID from a selected state snapshot.
The method resolves (event_type, state_key) to a short state key and
searches the compressed snapshot. An absent tuple is returned as not found.
Source§impl Service
impl Service
Sourcepub fn state_type_pdus<'a>(
&'a self,
shortstatehash: ShortStateHash,
event_type: &'a StateEventType,
) -> impl Stream<Item = impl Event> + Send + 'a
pub fn state_type_pdus<'a>( &'a self, shortstatehash: ShortStateHash, event_type: &'a StateEventType, ) -> impl Stream<Item = impl Event> + Send + 'a
Streams resolvable events of one type from a state snapshot.
Snapshot, short-ID, and timeline lookup failures are skipped, so this is a best-effort view rather than a completeness guarantee.
Source§impl Service
impl Service
Sourcepub fn state_keys_with_ids<'a>(
&'a self,
shortstatehash: ShortStateHash,
event_type: &'a StateEventType,
) -> impl Stream<Item = (StateKey, OwnedEventId)> + Send + 'a
pub fn state_keys_with_ids<'a>( &'a self, shortstatehash: ShortStateHash, event_type: &'a StateEventType, ) -> impl Stream<Item = (StateKey, OwnedEventId)> + Send + 'a
Streams state keys and event IDs for one type in a snapshot.
Snapshot and reverse-mapping failures are skipped. The stream buffers the selected short IDs before resolving event IDs in a batch.
Source§impl Service
impl Service
Sourcepub fn state_keys_with_shortids<'a>(
&'a self,
shortstatehash: ShortStateHash,
event_type: &'a StateEventType,
) -> impl Stream<Item = (StateKey, ShortEventId)> + Send + 'a
pub fn state_keys_with_shortids<'a>( &'a self, shortstatehash: ShortStateHash, event_type: &'a StateEventType, ) -> impl Stream<Item = (StateKey, ShortEventId)> + Send + 'a
Streams state keys and short event IDs for one type in a snapshot.
Snapshot and short-state-key mapping failures are skipped. The full compressed snapshot is buffered before filtering by event type.
Source§impl Service
impl Service
Sourcepub fn state_keys<'a>(
&'a self,
shortstatehash: ShortStateHash,
event_type: &'a StateEventType,
) -> impl Stream<Item = StateKey> + Send + 'a
pub fn state_keys<'a>( &'a self, shortstatehash: ShortStateHash, event_type: &'a StateEventType, ) -> impl Stream<Item = StateKey> + Send + 'a
Streams state keys for one event type in a snapshot.
Snapshot and short-state-key mapping failures are skipped, so the stream is best effort.
Source§impl Service
impl Service
Sourcepub fn state_removed(
&self,
shortstatehash: (ShortStateHash, ShortStateHash),
) -> impl Stream<Item = (ShortStateKey, ShortEventId)> + Send + '_
pub fn state_removed( &self, shortstatehash: (ShortStateHash, ShortStateHash), ) -> impl Stream<Item = (ShortStateKey, ShortEventId)> + Send + '_
Streams state entries removed between two snapshots.
Entries present in the first hash and absent from the second are returned. Failure to load either snapshot produces an empty stream.
Source§impl Service
impl Service
Sourcepub fn state_added(
&self,
shortstatehash: (ShortStateHash, ShortStateHash),
) -> impl Stream<Item = (ShortStateKey, ShortEventId)> + Send + '_
pub fn state_added( &self, shortstatehash: (ShortStateHash, ShortStateHash), ) -> impl Stream<Item = (ShortStateKey, ShortEventId)> + Send + '_
Streams state entries added between two snapshots.
Entries absent from the first hash and present in the second are returned. Failure to load either snapshot produces an empty stream.
Source§impl Service
impl Service
Sourcepub fn state_full(
&self,
shortstatehash: ShortStateHash,
) -> impl Stream<Item = ((StateEventType, StateKey), impl Event)> + Send + '_
pub fn state_full( &self, shortstatehash: ShortStateHash, ) -> impl Stream<Item = ((StateEventType, StateKey), impl Event)> + Send + '_
Streams resolvable keyed events from a state snapshot.
Events without a state key and entries with failed short-ID or timeline lookups are omitted by the underlying best-effort PDU stream.
Source§impl Service
impl Service
Sourcepub fn state_full_pdus(
&self,
shortstatehash: ShortStateHash,
) -> impl Stream<Item = impl Event> + Send + '_
pub fn state_full_pdus( &self, shortstatehash: ShortStateHash, ) -> impl Stream<Item = impl Event> + Send + '_
Streams every resolvable PDU from a state snapshot.
Snapshot, reverse-mapping, and timeline failures are silently skipped. Use
Self::state_full_pdus_strict when completeness is required.
Source§impl Service
impl Service
Sourcepub fn state_full_pdus_strict(
&self,
shortstatehash: ShortStateHash,
) -> impl Stream<Item = Result<impl Event>> + Send + '_
pub fn state_full_pdus_strict( &self, shortstatehash: ShortStateHash, ) -> impl Stream<Item = Result<impl Event>> + Send + '_
Streams every PDU in a state snapshot while preserving errors.
Snapshot and reverse-mapping failures are emitted before any partial ID map. Timeline lookup failures are yielded for their individual entries.
Source§impl Service
impl Service
Sourcepub fn state_full_ids(
&self,
shortstatehash: ShortStateHash,
) -> impl Stream<Item = (ShortStateKey, OwnedEventId)> + Send + '_
pub fn state_full_ids( &self, shortstatehash: ShortStateHash, ) -> impl Stream<Item = (ShortStateKey, OwnedEventId)> + Send + '_
Streams short state keys and resolvable event IDs from a snapshot.
Snapshot and reverse-mapping failures are skipped, so this best-effort
stream can be partial. Use Self::state_full_ids_strict for completeness.
Source§impl Service
impl Service
Sourcepub fn state_full_ids_strict(
&self,
shortstatehash: ShortStateHash,
) -> impl Stream<Item = Result<(ShortStateKey, OwnedEventId)>> + Send + '_
pub fn state_full_ids_strict( &self, shortstatehash: ShortStateHash, ) -> impl Stream<Item = Result<(ShortStateKey, OwnedEventId)>> + Send + '_
Streams a complete short-state-key to event-ID map for a snapshot.
Snapshot and reverse-mapping failures are returned without yielding a partial map.
Source§impl Service
impl Service
Sourcepub fn state_full_shortids(
&self,
shortstatehash: ShortStateHash,
) -> impl Stream<Item = Result<(ShortStateKey, ShortEventId)>> + Send + '_
pub fn state_full_shortids( &self, shortstatehash: ShortStateHash, ) -> impl Stream<Item = Result<(ShortStateKey, ShortEventId)>> + Send + '_
Streams every compressed (short state key, short event ID) pair.
A snapshot-load failure is yielded as an error. Once loaded, the immutable compressed state is copied into the stream without further lookups.
Source§impl Service
impl Service
async fn load_full_state( &self, shortstatehash: ShortStateHash, ) -> Result<Arc<CompressedState>>
Source§impl Service
impl Service
Sourcepub async fn user_can_redact(
&self,
redacts: &EventId,
sender: &UserId,
room_id: &RoomId,
federation: bool,
) -> Result<bool>
pub async fn user_can_redact( &self, redacts: &EventId, sender: &UserId, room_id: &RoomId, federation: bool, ) -> Result<bool>
Reports whether a user may redact an event in a room.
Cross-room targets are denied, while create and server-ACL targets return a forbidden error. Federation permits the own-event rule for any sender on the target sender’s server; power-level failures fall back to create-event ownership and exact sender equality.
Source§impl Service
impl Service
Sourcepub async fn user_can_see_event<Pdu>(&self, user_id: &UserId, pdu: &Pdu) -> boolwhere
Pdu: Event,
pub async fn user_can_see_event<Pdu>(&self, user_id: &UserId, pdu: &Pdu) -> boolwhere
Pdu: Event,
Reports whether a user may see an event under its historical visibility.
Missing event state is allowed, and missing or invalid history visibility
defaults to shared. The shared decision also accounts for the user’s
membership intervals around the event. Under joined and invited, the
user’s own membership event is visible when the membership it sets
qualifies, per the spec’s before-or-after rule.
Source§impl Service
impl Service
Sourceasync fn history_visibility_at(
&self,
event_id: &EventId,
) -> Option<(ShortStateHash, HistoryVisibility)>
async fn history_visibility_at( &self, event_id: &EventId, ) -> Option<(ShortStateHash, HistoryVisibility)>
The room state an event was sent in and the history visibility it carried.
Missing or invalid history visibility reads as shared, and None means
the event has no recorded state.
Source§impl Service
impl Service
Whether a user may see an event under shared history visibility.
A current member sees the whole room, which the first check answers without touching room state. A former member keeps events through their latest leave, and lookup failures deny access.
Source§impl Service
impl Service
Sourcepub async fn user_can_see_state_events(
&self,
user_id: &UserId,
room_id: &RoomId,
) -> bool
pub async fn user_can_see_state_events( &self, user_id: &UserId, room_id: &RoomId, ) -> bool
Reports whether a user may read the room’s current state events.
Current membership grants immediate access. Otherwise world-readable
history grants access; invited and shared visibility consult current
invitation or retained once-joined metadata. Missing visibility defaults
to shared.
Source§impl Service
impl Service
Sourcepub async fn user_can_see_room(
&self,
user_id: &UserId,
room_id: &RoomId,
) -> bool
pub async fn user_can_see_room( &self, user_id: &UserId, room_id: &RoomId, ) -> bool
Reports whether a user may discover or inspect a room.
Current join, invite, retained left membership, or world-readable history grants access. Forgetting a room clears the retained left membership and can therefore remove this visibility.
Source§impl Service
impl Service
Sourcepub async fn user_can_peek(&self, user_id: &UserId, room_id: &RoomId) -> bool
pub async fn user_can_peek(&self, user_id: &UserId, room_id: &RoomId) -> bool
Reports whether a user may peek into a room, as a room preview does.
A member always may, and anyone else only while the room’s history is
world-readable. Unlike user_can_see_room, a pending invite or a retained
left membership grants nothing here.
Source§impl Service
impl Service
Sourcepub async fn is_world_readable_at<Pdu>(&self, pdu: &Pdu) -> boolwhere
Pdu: Event,
pub async fn is_world_readable_at<Pdu>(&self, pdu: &Pdu) -> boolwhere
Pdu: Event,
Reports whether the room’s history was world-readable at an event.
A peek may show only such events, so an event without recorded state, or with missing or invalid history visibility, does not qualify. The event that makes the room world-readable counts as well, as the spec requires.
Source§impl Service
impl Service
Sourcepub async fn user_can_invite(
&self,
room_id: &RoomId,
sender: &UserId,
target_user: &UserId,
state_lock: &RoomMutexGuard,
) -> bool
pub async fn user_can_invite( &self, room_id: &RoomId, sender: &UserId, target_user: &UserId, state_lock: &RoomMutexGuard, ) -> bool
Probes whether a sender may invite a target user.
The normal event-build, authorization, and signing path runs under the caller’s room-state lock, but the synthetic membership event is not stored. Any build error denies the invite, while build-time ID allocations may remain.
Source§impl Service
impl Service
Sourcepub async fn user_can_tombstone(
&self,
room_id: &RoomId,
user_id: &UserId,
state_lock: &RoomMutexGuard,
) -> bool
pub async fn user_can_tombstone( &self, room_id: &RoomId, user_id: &UserId, state_lock: &RoomMutexGuard, ) -> bool
Probes whether a user may send a room tombstone.
The user must currently be joined. The normal event-build, authorization, and signing path evaluates a synthetic tombstone without storing it; any build error denies permission, while build-time ID allocations may remain.
Source§impl Service
impl Service
Sourcepub async fn get_power_levels(
&self,
room_id: &RoomId,
) -> Result<RoomPowerLevels>
pub async fn get_power_levels( &self, room_id: &RoomId, ) -> Result<RoomPowerLevels>
Returns the effective power levels for a room.
A missing or invalid m.room.power_levels event falls back to the room
version’s defaults. The create event and its room-version rules are required.
Sourcepub async fn get_create(&self, room_id: &RoomId) -> Result<RoomCreateEvent<Pdu>>
pub async fn get_create(&self, room_id: &RoomId) -> Result<RoomCreateEvent<Pdu>>
Returns the room’s current create event wrapper.
The lookup uses the empty state key and returns an error when the event or its state snapshot cannot be resolved.
Sourcepub async fn get_name(&self, room_id: &RoomId) -> Result<String>
pub async fn get_name(&self, room_id: &RoomId) -> Result<String>
Returns the room’s current non-empty name.
Missing, invalid, and empty m.room.name content is reported as an error.
Sourcepub async fn get_avatar(
&self,
room_id: &RoomId,
) -> Result<RoomAvatarEventContent>
pub async fn get_avatar( &self, room_id: &RoomId, ) -> Result<RoomAvatarEventContent>
Returns the room’s current avatar content.
Missing or invalid m.room.avatar state is returned as an error.
Sourcepub async fn get_member(
&self,
room_id: &RoomId,
user_id: &UserId,
) -> Result<RoomMemberEventContent>
pub async fn get_member( &self, room_id: &RoomId, user_id: &UserId, ) -> Result<RoomMemberEventContent>
Returns a user’s current membership event content in a room.
The user ID is used as the membership state key. Missing or invalid state is returned as an error.
Sourcepub async fn is_world_readable(&self, room_id: &RoomId) -> bool
pub async fn is_world_readable(&self, room_id: &RoomId) -> bool
Reports whether the room is world-readable.
Missing, unreadable, or invalid history-visibility state is treated as not world-readable.
Sourcepub async fn guest_can_join(&self, room_id: &RoomId) -> bool
pub async fn guest_can_join(&self, room_id: &RoomId) -> bool
Reports whether guest users may join the room.
Missing, unreadable, or invalid guest-access state is treated as denying guest joins.
Sourcepub async fn get_canonical_alias(
&self,
room_id: &RoomId,
) -> Result<OwnedRoomAliasId>
pub async fn get_canonical_alias( &self, room_id: &RoomId, ) -> Result<OwnedRoomAliasId>
Returns the room’s current primary canonical alias.
Alternate aliases are not considered. Missing state, invalid content, or an absent primary alias is returned as an error.
Sourcepub async fn get_room_topic(&self, room_id: &RoomId) -> Result<String>
pub async fn get_room_topic(&self, room_id: &RoomId) -> Result<String>
Returns the room’s current plain-text topic.
Rich-topic plain text takes precedence over the legacy field. Missing, invalid, or empty topic content is returned as an error.
Sourcepub async fn get_join_rules(&self, room_id: &RoomId) -> JoinRule
pub async fn get_join_rules(&self, room_id: &RoomId) -> JoinRule
Returns the room’s current join rule.
Any missing, unreadable, or invalid join-rules state falls back to
[JoinRule::Invite].
Sourcepub async fn get_room_type(&self, room_id: &RoomId) -> Result<RoomType>
pub async fn get_room_type(&self, room_id: &RoomId) -> Result<RoomType>
Returns the room type declared by the current create event.
A missing create event, invalid content, or absent room type is returned as an error; ordinary rooms therefore do not yield a synthetic type.
Sourcepub async fn get_room_encryption(
&self,
room_id: &RoomId,
) -> Result<EventEncryptionAlgorithm>
pub async fn get_room_encryption( &self, room_id: &RoomId, ) -> Result<EventEncryptionAlgorithm>
Returns the room’s configured encryption algorithm.
Missing or invalid m.room.encryption state is returned as an error.
Sourcepub async fn is_encrypted_room(&self, room_id: &RoomId) -> bool
pub async fn is_encrypted_room(&self, room_id: &RoomId) -> bool
Reports whether an encryption state event is present.
This checks that the event can be loaded, but does not deserialize its content or validate an encryption algorithm.
Source§impl Service
impl Service
Sourcepub async fn is_federating(&self, room_id: &RoomId) -> bool
pub async fn is_federating(&self, room_id: &RoomId) -> bool
Checks whether the room federates, per m.federate in its create event.
An absent m.federate means the room federates, which is the spec
default. A missing or unparsable create event reports the same, so a
failed read never reports a room as non-federating.
Trait Implementations§
Source§impl Service for Service
impl Service for Service
Source§fn build(args: &Args<'_>) -> Result<Arc<Self>>
fn build(args: &Args<'_>) -> Result<Arc<Self>>
Source§fn name(&self) -> &str
fn name(&self) -> &str
crate::service::make_name(std::module_path!())Source§fn worker<'async_trait>(
self: Arc<Self>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
fn worker<'async_trait>(
self: Arc<Self>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
Source§fn interrupt<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn interrupt<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn clear_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn memory_usage<'life0, 'life1, 'async_trait>(
&'life0 self,
_out: &'life1 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn memory_usage<'life0, 'life1, 'async_trait>(
&'life0 self,
_out: &'life1 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn unconstrained(&self) -> bool
fn unconstrained(&self) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for Service
impl !UnwindSafe for Service
impl Freeze for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnsafeUnpin for Service
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ExpectInto for T
impl<T> ExpectInto for T
Source§impl<T> Expected for T
impl<T> Expected for T
Source§fn expected_add(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedAdd,
fn expected_add(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedAdd,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_sub(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedSub,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedSub,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_mul(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedMul,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedMul,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_div(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedDiv,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedDiv,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_rem(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedRem,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedRem,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> JsonCastable<CanonicalJsonValue> for T
impl<T> JsonCastable<Value> for T
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§impl<T> Tried for T
impl<T> Tried for T
Source§fn try_add(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedAdd,
fn try_add(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedAdd,
rhs with checked arithmetic. Read moreSource§fn try_sub(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedSub,
fn try_sub(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedSub,
rhs with checked arithmetic. Read moreSource§fn try_mul(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedMul,
fn try_mul(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedMul,
rhs with checked arithmetic. Read more