The pipeline is finally reasonably clean

This commit is contained in:
2023-09-12 01:26:46 +01:00
parent 6693d93944
commit 8c866967a9
86 changed files with 1959 additions and 1393 deletions

View File

@@ -44,12 +44,13 @@ impl<'a, T> Substack<'a, T> {
Stackframe { item, prev: self, len: self.opt().map_or(1, |s| s.len + 1) }
}
/// obtain the previous stackframe if one exists
/// TODO: this should return a [Substack]
pub fn pop(&'a self, count: usize) -> Option<&'a Stackframe<'a, T>> {
if let Self::Frame(p) = self {
if count == 0 { Some(p) } else { p.prev.pop(count - 1) }
pub fn pop(&'a self, count: usize) -> &'a Substack<'a, T> {
if count == 0 {
self
} else if let Self::Frame(p) = self {
p.prev.pop(count - 1)
} else {
None
&Substack::Bottom
}
}
/// number of stackframes