Skip to main content

ProblemMetadata

Trait ProblemMetadata 

Source
pub trait ProblemMetadata {
    // Required method
    fn problem_info() -> ProblemInfo;
}
Expand description

Trait for problems that provide static metadata.

Implement this trait to enable introspection and discovery for problem types.

§Example

use problemreductions::registry::{
    ProblemMetadata, ProblemInfo, ComplexityClass
};

struct MyProblem;

impl ProblemMetadata for MyProblem {
    fn problem_info() -> ProblemInfo {
        ProblemInfo::new("My Problem", "Description")
            .with_complexity(ComplexityClass::NpComplete)
    }
}

// Get problem metadata
let info = MyProblem::problem_info();
assert_eq!(info.name, "My Problem");

Required Methods§

Source

fn problem_info() -> ProblemInfo

Returns the problem info for this problem type.

This includes the problem name, description, aliases, complexity class, and known reductions.

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§