Struct cranelift_isle::trie_again::BindingId
source · pub struct BindingId(_);
Expand description
A hash-consed identifier for a binding, stored in a RuleSet.
Implementations§
source§impl BindingId
impl BindingId
sourcepub fn index(self) -> usize
pub fn index(self) -> usize
Get the index of this id.
Examples found in repository?
src/trie_again.rs (line 454)
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
fn add_pattern_constraints(&mut self, expr: BindingId) {
match &self.rules.bindings[expr.index()] {
Binding::ConstInt { .. } | Binding::ConstPrim { .. } | Binding::Argument { .. } => {}
Binding::Constructor {
parameters: sources,
..
}
| Binding::MakeVariant {
fields: sources, ..
} => {
for source in sources.to_vec() {
self.add_pattern_constraints(source);
}
}
&Binding::Extractor {
parameter: source, ..
}
| &Binding::MatchVariant { source, .. }
| &Binding::MatchTuple { source, .. } => self.add_pattern_constraints(source),
&Binding::MatchSome { source } => {
self.set_constraint(source, Constraint::Some);
self.add_pattern_constraints(source);
}
}
}
Trait Implementations§
source§impl Ord for BindingId
impl Ord for BindingId
source§impl PartialEq<BindingId> for BindingId
impl PartialEq<BindingId> for BindingId
source§impl PartialOrd<BindingId> for BindingId
impl PartialOrd<BindingId> for BindingId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more