pub struct VariantEntry {Show 13 fields
pub name: &'static str,
pub variant_fn: fn() -> Vec<(&'static str, &'static str)>,
pub complexity: &'static str,
pub complexity_eval_fn: fn(&dyn Any) -> f64,
pub parameter_names_fn: fn() -> &'static [&'static str],
pub parameter_measure_fn: fn(&dyn Any) -> ProblemParameters,
pub is_default: bool,
pub aliases: &'static [&'static str],
pub create_inputs: Option<fn() -> Vec<CreateInputInfo>>,
pub construct_fn: ConstructProblemFn,
pub random: Option<RandomRegistration>,
pub factory: fn(Value) -> Result<Box<dyn DynProblem>, Error>,
pub serialize_fn: fn(&dyn Any) -> Option<Value>,
}Expand description
A registered problem variant entry.
Submitted by declare_variants! for each concrete problem type.
The reduction graph uses these entries to build nodes with complexity metadata.
Fields§
§name: &'static strProblem name (from Problem::NAME).
variant_fn: fn() -> Vec<(&'static str, &'static str)>Function returning variant key-value pairs (from Problem::variant()).
complexity: &'static strWorst-case time complexity expression (e.g., "2^num_vertices").
complexity_eval_fn: fn(&dyn Any) -> f64Compiled complexity evaluation function.
Takes a &dyn Any (must be &ProblemType), calls getter methods directly,
and returns the estimated worst-case time as f64.
parameter_names_fn: fn() -> &'static [&'static str]Canonical problem-owned parameter names.
parameter_measure_fn: fn(&dyn Any) -> ProblemParametersMeasure the complete canonical parameters of a concrete instance.
is_default: boolWhether this entry is the declared default variant for its problem.
aliases: &'static [&'static str]Variant-level aliases (e.g., &["3SAT"] for KSatisfiability<K3>).
Unlike problem-level aliases (on ProblemSchemaEntry), these resolve to a
specific reduction-graph node, not just to a canonical problem name. The CLI
resolver tries variant-level aliases first and falls back to problem-level.
create_inputs: Option<fn() -> Vec<CreateInputInfo>>Custom construction inputs. None means the catalog schema fields are
also the construction inputs through the direct path.
construct_fn: ConstructProblemFnConstruct a validated concrete problem from normalized construction data.
random: Option<RandomRegistration>Model-owned random generator for this exact variant.
factory: fn(Value) -> Result<Box<dyn DynProblem>, Error>Factory: deserialize JSON into a boxed dynamic problem.
serialize_fn: fn(&dyn Any) -> Option<Value>Serialize: downcast &dyn Any and serialize to JSON.
Implementations§
Source§impl VariantEntry
impl VariantEntry
Sourcepub fn inputs(&self) -> Vec<CreateInputInfo>
pub fn inputs(&self) -> Vec<CreateInputInfo>
Inputs accepted by this concrete variant’s constructor.
Sourcepub fn variant(&self) -> Vec<(&'static str, &'static str)>
pub fn variant(&self) -> Vec<(&'static str, &'static str)>
Get the variant by calling the function.
Sourcepub fn variant_map(&self) -> BTreeMap<String, String>
pub fn variant_map(&self) -> BTreeMap<String, String>
Get the variant as a BTreeMap<String, String>.
Sourcepub fn parameter_names(&self) -> &'static [&'static str]
pub fn parameter_names(&self) -> &'static [&'static str]
Return the canonical parameter names for this exact variant.
Trait Implementations§
impl Collect for VariantEntry
Auto Trait Implementations§
impl Freeze for VariantEntry
impl RefUnwindSafe for VariantEntry
impl Send for VariantEntry
impl Sync for VariantEntry
impl Unpin for VariantEntry
impl UnsafeUnpin for VariantEntry
impl UnwindSafe for VariantEntry
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.