pub trait IdCategory {
// Required method
fn category_name() -> &'static str;
// Provided methods
fn validate_id(ulid: &Ulid) -> Result<(), PipelineError> { ... }
fn allows_nil() -> bool { ... }
}Expand description
ID category trait for type-specific behavior
This trait defines the interface for ID categories, allowing different types of IDs to have category-specific validation rules and behavior.
§Key Features
- Category Identification: Unique name for each ID category
- Custom Validation: Category-specific validation logic
- Nil Handling: Configure whether nil values are allowed
- Extensibility: Easy to add new ID categories
§Examples
Required Methods§
Sourcefn category_name() -> &'static str
fn category_name() -> &'static str
Gets the category name for this ID type
Provided Methods§
Sourcefn validate_id(ulid: &Ulid) -> Result<(), PipelineError>
fn validate_id(ulid: &Ulid) -> Result<(), PipelineError>
Validates category-specific constraints
Sourcefn allows_nil() -> bool
fn allows_nil() -> bool
Checks if this ID type should allow nil values
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.