aidaemon_core/
audience.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum ChannelVisibility {
8 Private,
10 PrivateGroup,
12 Public,
14 PublicExternal,
16 Internal,
18}
19
20impl std::fmt::Display for ChannelVisibility {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 match self {
23 ChannelVisibility::Private => write!(f, "private"),
24 ChannelVisibility::PrivateGroup => write!(f, "private_group"),
25 ChannelVisibility::Public => write!(f, "public"),
26 ChannelVisibility::PublicExternal => write!(f, "public_external"),
27 ChannelVisibility::Internal => write!(f, "internal"),
28 }
29 }
30}
31
32impl ChannelVisibility {
33 pub fn from_str_lossy(s: &str) -> Self {
35 match s {
36 "private" => Self::Private,
37 "private_group" => Self::PrivateGroup,
38 "public" => Self::Public,
39 "public_external" => Self::PublicExternal,
40 "internal" => Self::Internal,
41 _ => Self::Internal,
42 }
43 }
44}
45
46#[derive(Debug, Clone, Copy, PartialEq, Eq)]
48pub enum UserRole {
49 Owner,
51 Guest,
53 Public,
55}
56
57impl std::fmt::Display for UserRole {
58 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
59 match self {
60 UserRole::Owner => write!(f, "owner"),
61 UserRole::Guest => write!(f, "guest"),
62 UserRole::Public => write!(f, "public"),
63 }
64 }
65}
66
67impl UserRole {
68 #[doc(hidden)]
71 pub fn can_persist_owner_memory(self) -> bool {
72 matches!(self, Self::Owner)
73 }
74}