Trait ValidationRule

Source
pub trait ValidationRule<'a>: Visitor<'a, ValidationContext<'a>> + Default {
    // Provided method
    fn validate(ctx: &'a ASTContext, document: &'a Document<'a>) -> Result<()> { ... }
}
Expand description

Trait for a ValidationRule that checks a given GraphQl document against its rules using a visitor.

A rule always implements a visitor and accepts the ValidationContext structure as its passed context.

Rules implement the Default trait, which allows them to be instantiated easily. The intention of using Default is for rules to not carry any external state as for GraphQL validation no external state is needed.

Provided Methods§

Source

fn validate(ctx: &'a ASTContext, document: &'a Document<'a>) -> Result<()>

Run this ValidationRule against the given document and return a result which errors if the rule fails on the document.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§