mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
add index for variables slice
This commit is contained in:
parent
4386d3d5f4
commit
823824c62d
1 changed files with 14 additions and 0 deletions
|
@ -134,6 +134,20 @@ impl std::ops::IndexMut<SubsIndex<RecordField<()>>> for Subs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::ops::Index<SubsIndex<VariableSubsSlice>> for Subs {
|
||||||
|
type Output = VariableSubsSlice;
|
||||||
|
|
||||||
|
fn index(&self, index: SubsIndex<VariableSubsSlice>) -> &Self::Output {
|
||||||
|
&self.variable_slices[index.start as usize]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::ops::IndexMut<SubsIndex<VariableSubsSlice>> for Subs {
|
||||||
|
fn index_mut(&mut self, index: SubsIndex<VariableSubsSlice>) -> &mut Self::Output {
|
||||||
|
&mut self.variable_slices[index.start as usize]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// custom debug
|
// custom debug
|
||||||
|
|
||||||
impl<T> std::fmt::Debug for SubsIndex<T> {
|
impl<T> std::fmt::Debug for SubsIndex<T> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue