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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#[repr(C)]
#[derive(Debug, Clone, PartialEq)]
pub enum MagicCommentKind {
Encoding,
FrozenStringLiteral,
WarnIndent,
ShareableConstantValue,
}
impl MagicCommentKind {
pub fn encoding() -> Self {
Self::Encoding
}
pub fn frozen_string_literal() -> Self {
Self::FrozenStringLiteral
}
pub fn warn_indent() -> Self {
Self::WarnIndent
}
pub fn shareable_constant_value() -> Self {
Self::ShareableConstantValue
}
pub fn is_encoding(&self) -> bool {
matches!(self, Self::Encoding)
}
pub fn is_frozen_string_literal(&self) -> bool {
matches!(self, Self::FrozenStringLiteral)
}
pub fn is_warn_indent(&self) -> bool {
matches!(self, Self::WarnIndent)
}
pub fn is_shareable_constant_value(&self) -> bool {
matches!(self, Self::ShareableConstantValue)
}
}