Trait prae::Guard[][src]

pub trait Guard {
    type Target;
    type Error;
    fn adjust(v: &mut Self::Target);
fn validate(v: &Self::Target) -> Option<Self::Error>; }
Expand description

A trait that represents a guard bound, e.g. a type that is being guarded, adjust/validate functions and a possible validation error.

Associated Types

The type that is being guarded.

An error that will be returned in case of failed validation.

Required methods

A function that can make small adjustments of the provided value before validation.

A function that validates provided value. If the value is not valid, it returns Some(Self::Error).

Implementors