add index for variables slice

This commit is contained in:
Folkert 2021-08-11 20:11:50 +02:00
parent 4386d3d5f4
commit 823824c62d

View file

@ -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> {