21 lines
372 B
Rust
21 lines
372 B
Rust
macro_rules! mimes {
|
|
($($ident: ident = $value: literal),*$(,)?) => {
|
|
pub enum MimeType {
|
|
$($ident),*
|
|
}
|
|
|
|
impl MimeType {
|
|
pub fn text(&self) -> &'static str {
|
|
match self { $(Self::$ident => $value),* }
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
mimes! {
|
|
Txt = "text/plain",
|
|
Html = "text/html",
|
|
Css = "text/css",
|
|
Js = "text/javascript",
|
|
}
|