From 2dcb6963fadf6ad000418f54eeffc431b5167e00 Mon Sep 17 00:00:00 2001 From: robtfm <50659922+robtfm@users.noreply.github.com> Date: Mon, 5 Dec 2022 15:59:07 +0000 Subject: [PATCH] add Range::new_from_bounds --- src/arena.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/arena.rs b/src/arena.rs index 5d5cf37935..99d977b2ff 100644 --- a/src/arena.rs +++ b/src/arena.rs @@ -153,6 +153,15 @@ impl Iterator for Range { } } +impl Range { + pub fn new_from_bounds(first: Handle, last: Handle) -> 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. ///