Skip to content

Commit

Permalink
Use boxed iterators for now
Browse files Browse the repository at this point in the history
  • Loading branch information
AZWN committed Nov 30, 2023
1 parent cf96ac3 commit a0e1095
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 0 additions & 2 deletions scopegraphs-lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(impl_trait_in_assoc_type)]

pub mod label;
pub mod resolve;
pub mod scopegraph;
13 changes: 7 additions & 6 deletions scopegraphs-lib/src/scopegraph/completeness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ impl<LABEL: Hash + Eq, DATA> Completeness<LABEL, DATA> for UncheckedCompleteness
inner_scope_graph.add_edge(src, lbl, dst)
}

type GetEdgesResult<'a> = impl Iterator<Item = Scope> + 'a where DATA: 'a, LABEL: 'a;
type GetEdgesResult<'a> = Box<dyn Iterator<Item = Scope> + 'a> where DATA: 'a, LABEL: 'a;

fn get_edges<'a, 'b: 'a>(
&mut self,
inner_scope_graph: &'a InnerScopeGraph<LABEL, DATA>,
src: Scope,
lbl: &'b LABEL,
) -> Self::GetEdgesResult<'a> {
inner_scope_graph.get_edges(src, lbl)
Box::new(inner_scope_graph.get_edges(src, lbl))
}
}

Expand Down Expand Up @@ -143,7 +143,8 @@ impl<LABEL: Hash + Eq + for<'a> Label<'a>, DATA> Completeness<LABEL, DATA>
}
}

type GetEdgesResult<'a> = EdgesOrDelay<'a, impl Iterator<Item = Scope>, LABEL> where DATA: 'a, LABEL: 'a;

type GetEdgesResult<'a> = EdgesOrDelay<'a, Box<dyn Iterator<Item = Scope> + 'a>, LABEL> where DATA: 'a, LABEL: 'a;

fn get_edges<'a, 'b: 'a>(
&mut self,
Expand All @@ -158,7 +159,7 @@ impl<LABEL: Hash + Eq + for<'a> Label<'a>, DATA> Completeness<LABEL, DATA>
}
} else {
EdgesOrDelay::Edges {
edges: inner_scope_graph.get_edges(src, lbl),
edges: Box::new(inner_scope_graph.get_edges(src, lbl)),
}
}
}
Expand Down Expand Up @@ -202,7 +203,7 @@ impl<LABEL: Hash + Eq + for<'a> Label<'a>, DATA> Completeness<LABEL, DATA>
}
}

type GetEdgesResult<'a> = impl Iterator<Item = Scope> where DATA: 'a, LABEL: 'a;
type GetEdgesResult<'a> = Box<dyn Iterator<Item = Scope> + 'a> where DATA: 'a, LABEL: 'a;

fn get_edges<'a, 'b: 'a>(
&mut self,
Expand All @@ -211,7 +212,7 @@ impl<LABEL: Hash + Eq + for<'a> Label<'a>, DATA> Completeness<LABEL, DATA>
lbl: &'b LABEL,
) -> Self::GetEdgesResult<'a> {
self.critical_edges.close(src, &lbl);
inner_scope_graph.get_edges(src, lbl)
Box::new(inner_scope_graph.get_edges(src, lbl))
}
}

Expand Down

0 comments on commit a0e1095

Please sign in to comment.