Skip to repository content31 lines · 728 B · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T04:03:01.623Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
role.rs
1use serde::{Deserialize, Serialize};
2use std::fmt::{self, Display};
3
4#[derive(Clone, Copy, Serialize, Deserialize, Debug, Eq, PartialEq, Hash)]
5#[serde(rename_all = "lowercase")]
6pub enum Role {
7 User,
8 Assistant,
9 System,
10}
11
12impl Role {
13 pub fn cycle(self) -> Role {
14 match self {
15 Role::User => Role::Assistant,
16 Role::Assistant => Role::System,
17 Role::System => Role::User,
18 }
19 }
20}
21
22impl Display for Role {
23 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result {
24 match self {
25 Role::User => write!(f, "user"),
26 Role::Assistant => write!(f, "assistant"),
27 Role::System => write!(f, "system"),
28 }
29 }
30}
31