Skip to content
Clone
acbf7ea
28 lines 464 B Rust
use serde::{Deserialize, Serialize};
#[derive(
Debug,
Clone,
Copy,
PartialEq,
Eq,
Default,
Serialize,
Deserialize,
utoipa::ToSchema,
)]
#[serde(rename_all = "snake_case")]
pub enum AccessKeyScope {
#[default]
Read,
Write,
}
impl AccessKeyScope {
pub const fn allows(self, want_write: bool) -> bool {
match self {
Self::Write => true,
Self::Read => !want_write,
}
}
}