cynic_parser/common/
mod.rs

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
mod id_range;
mod int_value;
mod strings;
mod types;

pub use id_range::{IdOperations, IdRange, IdRangeIter};
pub use int_value::IntValue;
pub use strings::MalformedStringError;
pub use types::*;

pub(crate) use strings::{trim_block_string_whitespace, unquote_block_string, unquote_string};

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OperationType {
    Query,
    Mutation,
    Subscription,
}

impl OperationType {
    pub fn as_str(&self) -> &'static str {
        match self {
            OperationType::Query => "query",
            OperationType::Mutation => "mutation",
            OperationType::Subscription => "subscription",
        }
    }
}

impl std::fmt::Display for OperationType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}