Skip to main content

core_crypto/mls/conversation/
pending_status.rs

1/// Whether a conversation is pending or initialized
2#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
3pub enum PendingStatus {
4    /// The conversation is operational
5    #[default]
6    Operational,
7    /// The conversation is pending, waiting for a commit to make it operational
8    Pending,
9}
10
11impl PendingStatus {
12    /// `true` when this status is pending
13    #[inline]
14    pub fn is_pending(self) -> bool {
15        match self {
16            PendingStatus::Operational => false,
17            PendingStatus::Pending => true,
18        }
19    }
20
21    /// Create an instance from an `is_pending` boolean
22    #[inline]
23    pub fn from_is_pending(is_pending: bool) -> Self {
24        if is_pending { Self::Pending } else { Self::Operational }
25    }
26}