Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'lib/la-arena/src/lib.rs')
-rw-r--r--lib/la-arena/src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/la-arena/src/lib.rs b/lib/la-arena/src/lib.rs
index 07608a4185..b03fa5b61d 100644
--- a/lib/la-arena/src/lib.rs
+++ b/lib/la-arena/src/lib.rs
@@ -19,12 +19,14 @@ pub use map::{ArenaMap, Entry, OccupiedEntry, VacantEntry};
pub struct RawIdx(u32);
impl From<RawIdx> for u32 {
+ #[inline]
fn from(raw: RawIdx) -> u32 {
raw.0
}
}
impl From<u32> for RawIdx {
+ #[inline]
fn from(idx: u32) -> RawIdx {
RawIdx(idx)
}
@@ -160,6 +162,16 @@ impl<T> IdxRange<T> {
pub fn is_empty(&self) -> bool {
self.range.is_empty()
}
+
+ /// Returns the start of the index range.
+ pub fn start(&self) -> Idx<T> {
+ Idx::from_raw(RawIdx::from(self.range.start))
+ }
+
+ /// Returns the start of the index range.
+ pub fn end(&self) -> Idx<T> {
+ Idx::from_raw(RawIdx::from(self.range.end))
+ }
}
impl<T> Iterator for IdxRange<T> {