ruma_common/
presence.rs

1//! Common types for the [presence module][presence].
2//!
3//! [presence]: https://spec.matrix.org/latest/client-server-api/#presence
4
5use crate::{serde::StringEnum, PrivOwnedStr};
6
7/// A description of a user's connectivity and availability for chat.
8#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
9#[derive(Clone, Default, PartialEq, Eq, StringEnum)]
10#[ruma_enum(rename_all = "snake_case")]
11#[non_exhaustive]
12pub enum PresenceState {
13    /// Disconnected from the service.
14    Offline,
15
16    /// Connected to the service.
17    #[default]
18    Online,
19
20    /// Connected to the service but not available for chat.
21    Unavailable,
22
23    #[doc(hidden)]
24    _Custom(PrivOwnedStr),
25}
26
27impl Default for &'_ PresenceState {
28    fn default() -> Self {
29        &PresenceState::Online
30    }
31}