Skip to content

Commit 26617f7

Browse files
authored
changed: sub_cfg_from_indices accepts any iterator for nodes (#152)
1 parent 0dd42bb commit 26617f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

jingle/src/analysis/cfg/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,14 @@ impl<N: CfgState, D: ModelTransition<N::Model>> PcodeCfg<N, D> {
322322
///
323323
/// If the resulting subgraph has more than one connected component (treating edges as undirected
324324
/// for connectivity), this function will panic.
325-
pub fn sub_cfg_from_indices(&self, selected: &HashSet<NodeIndex>) -> PcodeCfg<N, D> {
325+
pub fn sub_cfg_from_indices<I: Iterator<Item = NodeIndex>>(
326+
&self,
327+
selected: I,
328+
) -> PcodeCfg<N, D> {
326329
// Build the set of NodeIndex that we will include: exactly the selected nodes.
327330
// Do NOT include outgoing neighbors or nodes that only have incoming edges into the selected set.
328331
let mut include: HashSet<NodeIndex> = HashSet::new();
329-
for &idx in selected {
332+
for idx in selected {
330333
include.insert(idx);
331334
}
332335

0 commit comments

Comments
 (0)