cynic_parser_deser/value/
enums.rs1use cynic_parser::Span;
2
3#[derive(Clone, Copy)]
4pub struct EnumValue<'a> {
5 pub(crate) name: &'a str,
6 pub(crate) span: Option<Span>,
7}
8
9impl<'a> EnumValue<'a> {
10 pub fn name(&self) -> &'a str {
11 self.name
12 }
13
14 pub fn span(&self) -> Option<Span> {
15 self.span
16 }
17}
18
19impl PartialEq for EnumValue<'_> {
20 fn eq(&self, other: &Self) -> bool {
21 self.name() == other.name()
22 }
23}
24
25impl Eq for EnumValue<'_> {}
26
27impl std::fmt::Debug for EnumValue<'_> {
28 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29 write!(f, "{}", self.name())
30 }
31}
32
33impl std::fmt::Display for EnumValue<'_> {
34 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35 write!(f, "{}", self.name())
36 }
37}