teo_parser/type/
keyword.rs1use std::fmt::{Display, Formatter};
2use serde::Serialize;
3
4#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Serialize)]
5pub enum Keyword {
6 SelfIdentifier,
7 ThisFieldType,
8}
9
10impl Keyword {
11
12 pub(crate) fn is_self(&self) -> bool {
13 match self {
14 Keyword::SelfIdentifier => true,
15 _ => false,
16 }
17 }
18
19 pub(crate) fn is_this_field_type(&self) -> bool {
20 match self {
21 Keyword::ThisFieldType => true,
22 _ => false,
23 }
24 }
25}
26
27impl Display for Keyword {
28
29 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
30 match self {
31 Keyword::SelfIdentifier => f.write_str("Self"),
32 Keyword::ThisFieldType => f.write_str("ThisFieldType"),
33 }
34 }
35}