blob: 5f3906c67d939deac2966f4937a0be3992c509e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
use serde::{Deserialize, Serialize};
bitflags::bitflags! {
#[derive(Serialize, Deserialize)]
pub struct Extensions: usize {
const UNWRAP_NEWTYPES = 0x1;
const IMPLICIT_SOME = 0x2;
}
}
impl Extensions {
/// Creates an extension flag from an ident.
pub fn from_ident(ident: &[u8]) -> Option<Extensions> {
match ident {
b"unwrap_newtypes" => Some(Extensions::UNWRAP_NEWTYPES),
b"implicit_some" => Some(Extensions::IMPLICIT_SOME),
_ => None,
}
}
}
impl Default for Extensions {
fn default() -> Self {
Extensions::empty()
}
}
|