pub trait FromIndexKey: Sized {
// Required method
fn from_index_key(k: &IndexKey) -> Self;
}Expand description
Typed projection of an IndexKey. Implementations panic when the
key’s shape does not match the target type, the same contract as
crate::indexed::IndexedVar indexing on a missing key.
Used by crate::model::Model::add_constraints_over (and similar rule
helpers) to give the closure typed indices directly:
ⓘ
m.add_constraints_over("supply", &(&plants * &markets), |(p, m): (String, String)| {
// p, m are native String, no manual unpack
...
});Required Methods§
fn from_index_key(k: &IndexKey) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".