mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-10 07:06:53 +00:00
23 lines
483 B
Rust
23 lines
483 B
Rust
use serde::{Deserialize, Serialize};
|
|
use std::str::FromStr;
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default)]
|
|
pub enum Effect {
|
|
#[default]
|
|
Allow,
|
|
Deny,
|
|
}
|
|
|
|
// 实现从字符串解析Effect的功能
|
|
impl FromStr for Effect {
|
|
type Err = ();
|
|
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
match s {
|
|
"Allow" => Ok(Effect::Allow),
|
|
"Deny" => Ok(Effect::Deny),
|
|
_ => Err(()),
|
|
}
|
|
}
|
|
}
|