pub struct ValidationGraph<const N: usize> { /* private fields */ }Expand description
A stack-allocated validation graph with up to N nodes.
Nodes execute sequentially. The graph can run in two modes:
- Fail-fast (
run): stops at first error - Accumulate (
run_all): runs all nodes, returns first error
Implementations§
Source§impl<const N: usize> ValidationGraph<N>
impl<const N: usize> ValidationGraph<N>
Sourcepub fn add(&mut self, node: ValidateFn) -> Result<(), ProgramError>
pub fn add(&mut self, node: ValidateFn) -> Result<(), ProgramError>
Add a validation node.
Sourcepub fn run(&self, ctx: &ValidationContext<'_>) -> ProgramResult
pub fn run(&self, ctx: &ValidationContext<'_>) -> ProgramResult
Run all validations, fail-fast on first error.
Sourcepub fn run_all(&self, ctx: &ValidationContext<'_>) -> ProgramResult
pub fn run_all(&self, ctx: &ValidationContext<'_>) -> ProgramResult
Run all validations, accumulate results. Returns the first error found.
Trait Implementations§
Source§impl<const N: usize> Default for ValidationGraph<N>
impl<const N: usize> Default for ValidationGraph<N>
Source§impl<const M: usize> Validatable for ValidationGraph<M>
impl<const M: usize> Validatable for ValidationGraph<M>
Source§fn validate(&self, ctx: &ValidationContext<'_>) -> ProgramResult
fn validate(&self, ctx: &ValidationContext<'_>) -> ProgramResult
Run validation against the given context.
Auto Trait Implementations§
impl<const N: usize> Freeze for ValidationGraph<N>
impl<const N: usize> RefUnwindSafe for ValidationGraph<N>
impl<const N: usize> Send for ValidationGraph<N>
impl<const N: usize> Sync for ValidationGraph<N>
impl<const N: usize> Unpin for ValidationGraph<N>
impl<const N: usize> UnsafeUnpin for ValidationGraph<N>
impl<const N: usize> UnwindSafe for ValidationGraph<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more