cynic_parser/type_system/
schemas.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::common::OperationType;

impl<'a> super::SchemaDefinition<'a> {
    pub fn query_type(&self) -> Option<super::RootOperationTypeDefinition<'a>> {
        self.root_operations()
            .find(|operation| matches!(operation.operation_type(), OperationType::Query))
    }

    pub fn mutation_type(&self) -> Option<super::RootOperationTypeDefinition<'a>> {
        self.root_operations()
            .find(|operation| matches!(operation.operation_type(), OperationType::Mutation))
    }

    pub fn subscription_type(&self) -> Option<super::RootOperationTypeDefinition<'a>> {
        self.root_operations()
            .find(|operation| matches!(operation.operation_type(), OperationType::Subscription))
    }
}