cynic_parser/type_system/
schemas.rs

1use crate::common::OperationType;
2
3impl<'a> super::SchemaDefinition<'a> {
4    pub fn query_type(&self) -> Option<super::RootOperationTypeDefinition<'a>> {
5        self.root_operations()
6            .find(|operation| matches!(operation.operation_type(), OperationType::Query))
7    }
8
9    pub fn mutation_type(&self) -> Option<super::RootOperationTypeDefinition<'a>> {
10        self.root_operations()
11            .find(|operation| matches!(operation.operation_type(), OperationType::Mutation))
12    }
13
14    pub fn subscription_type(&self) -> Option<super::RootOperationTypeDefinition<'a>> {
15        self.root_operations()
16            .find(|operation| matches!(operation.operation_type(), OperationType::Subscription))
17    }
18}