Skip to main content

StatusValidator

Trait StatusValidator 

Source
pub trait StatusValidator {
    const VALIDATION_MODE: ValidationMode;

    // Required method
    fn default_statuses() -> Vec<String>;

    // Provided method
    fn validate_status(
        status: &str,
        allowed: &[String],
    ) -> Result<(), StatusError> { ... }
}
Expand description

Trait for items that have status validation.

Different item types can have different validation strategies:

  • Strict: Rejects invalid statuses
  • None: No status concept

Required Associated Constants§

Source

const VALIDATION_MODE: ValidationMode

The validation mode for this item type

Required Methods§

Source

fn default_statuses() -> Vec<String>

Get the default allowed statuses for this item type

Provided Methods§

Source

fn validate_status(status: &str, allowed: &[String]) -> Result<(), StatusError>

Validate a status value against allowed statuses.

The behavior depends on the validation mode:

  • Strict: Returns Err if status is not in allowed list
  • None: Always returns Ok

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§