Enum erg_compiler::context::TyParamIdx
source · pub enum TyParamIdx {
Nth(usize),
Nested {
idx: usize,
inner: Box<TyParamIdx>,
},
}
Expand description
let r = Type::mono_q("R");
let o = Type::mono_q("O");
let search_from = Type::poly("Add", vec![TyParam::t(r.clone()), TyParam::t(o.clone())]);
assert_eq!(TyParamIdx::search(&search_from, &o), Some(TyParamIdx::Nth(1)));
let i = Type::mono_q("I");
let f = Type::poly("F", vec![TyParam::t(o.clone()), TyParam::t(i.clone())]);
let search_from = Type::poly("Add", vec![TyParam::t(r), TyParam::t(f)]);
assert_eq!(TyParamIdx::search(&search_from, &o), Some(TyParamIdx::nested(1, TyParamIdx::Nth(0))));
Variants§
Implementations§
Trait Implementations§
source§impl Clone for TyParamIdx
impl Clone for TyParamIdx
source§fn clone(&self) -> TyParamIdx
fn clone(&self) -> TyParamIdx
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more