Add Apophis special role
This commit is contained in:
parent
6f786c5cc9
commit
4d9b03ff18
@ -25,13 +25,15 @@ pub const MAX_PRD_PAYLOAD_SIZE: usize = u16::MAX as usize; // 64KiB sounds reaso
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum SpecialRoles {
|
||||
DEMIURGE,
|
||||
DEMIURGE, // Only valid for the first state of a process
|
||||
APOPHIS, // Users in this role have the power to destroy the process
|
||||
}
|
||||
|
||||
impl std::fmt::Display for SpecialRoles {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let role_str = match self {
|
||||
SpecialRoles::DEMIURGE => "demiurge",
|
||||
SpecialRoles::APOPHIS => "apophis",
|
||||
};
|
||||
write!(f, "{}", role_str)
|
||||
}
|
||||
@ -43,6 +45,7 @@ impl FromStr for SpecialRoles {
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"demiurge" => Ok(SpecialRoles::DEMIURGE),
|
||||
"apophis" => Ok(SpecialRoles::APOPHIS),
|
||||
_ => Err(format!("Invalid role: {}", s)),
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user