mirror of
https://github.com/actix/actix-extras.git
synced 2025-03-28 07:08:38 +01:00
25 lines
562 B
Rust
25 lines
562 B
Rust
use serde::Deserialize;
|
|
|
|
use crate::{AtResult, Parse};
|
|
|
|
///
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize)]
|
|
#[serde(rename_all = "lowercase")]
|
|
pub enum Mode {
|
|
Development,
|
|
Production,
|
|
}
|
|
|
|
impl Parse for Mode {
|
|
fn parse(string: &str) -> AtResult<Self> {
|
|
match string {
|
|
"development" => Ok(Self::Development),
|
|
"production" => Ok(Self::Production),
|
|
_ => Err(InvalidValue! {
|
|
expected: "\"development\" | \"production\".",
|
|
got: string,
|
|
}),
|
|
}
|
|
}
|
|
}
|