WeightProvider

Trait WeightProvider 

Source
pub trait WeightProvider<Sc: Score>: Send + Sync {
    // Required method
    fn weight(&self, name: &str) -> Option<Sc>;

    // Provided method
    fn weight_or_default(&self, name: &str, default: Sc) -> Sc { ... }
}
Expand description

Helper trait for creating weight functions from overrides.

This enables zero-erasure constraint building with runtime weight lookup.

Required Methods§

Source

fn weight(&self, name: &str) -> Option<Sc>

Gets the weight for a constraint by name.

Provided Methods§

Source

fn weight_or_default(&self, name: &str, default: Sc) -> Sc

Gets the weight or returns the default.

Implementations on Foreign Types§

Source§

impl<Sc: Score> WeightProvider<Sc> for Arc<ConstraintWeightOverrides<Sc>>

Source§

fn weight(&self, name: &str) -> Option<Sc>

Implementors§