Skip to main content

ValidateContext

Trait ValidateContext 

Source
pub trait ValidateContext {
    type Context;

    // Required method
    fn validate_inner_ctx(
        &self,
        accum: &mut Accumulator,
        context: &Self::Context,
    );

    // Provided method
    fn validate_ctx(&self, context: &Self::Context) -> Result { ... }
}
Expand description

Trait for synchronous validation where some external data or context is required.

Required Associated Types§

Source

type Context

Type of context which the validator needs (external data, resources etc.)

Required Methods§

Source

fn validate_inner_ctx(&self, accum: &mut Accumulator, context: &Self::Context)

Accumulate validation errors.

Validators of containing types should call this; end users probably want [ValidateContext::validate] instead.

Provided Methods§

Source

fn validate_ctx(&self, context: &Self::Context) -> Result

Perform top-level validation on this value, with the given context.

Should not be called inside other validators; use [ValidateContext::validate_inner] instead. Should not be overridden by implementors.

Implementors§