revolt_permissions/models/
user.rs1use std::fmt;
2
3pub enum RelationshipStatus {
5 None,
6 User,
7 Friend,
8 Outgoing,
9 Incoming,
10 Blocked,
11 BlockedOther,
12}
13
14#[derive(Debug, PartialEq, Eq, Copy, Clone)]
16#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
17#[cfg_attr(feature = "try-from-primitive", derive(num_enum::TryFromPrimitive))]
18#[repr(u32)]
19pub enum UserPermission {
20 Access = 1 << 0,
21 ViewProfile = 1 << 1,
22 SendMessage = 1 << 2,
23 Invite = 1 << 3,
24}
25
26impl fmt::Display for UserPermission {
27 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
28 fmt::Debug::fmt(self, f)
29 }
30}
31
32impl_op_ex!(+ |a: &UserPermission, b: &UserPermission| -> u32 { *a as u32 | *b as u32 });
33impl_op_ex_commutative!(+ |a: &u32, b: &UserPermission| -> u32 { *a | *b as u32 });