Skip to content

Commit

Permalink
add Range::new_from_bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
robtfm authored and teoxoy committed Dec 12, 2022
1 parent 0197246 commit 2dcb696
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ impl<T> Iterator for Range<T> {
}
}

impl<T> Range<T> {
pub fn new_from_bounds(first: Handle<T>, last: Handle<T>) -> Self {
Self {
inner: (first.index() as u32)..(last.index() as u32 + 1),
marker: Default::default(),
}
}
}

/// An arena holding some kind of component (e.g., type, constant,
/// instruction, etc.) that can be referenced.
///
Expand Down

0 comments on commit 2dcb696

Please sign in to comment.