aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_arena
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_arena')
-rw-r--r--crates/ra_arena/src/lib.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/ra_arena/src/lib.rs b/crates/ra_arena/src/lib.rs
index d7d5d5265..97f554838 100644
--- a/crates/ra_arena/src/lib.rs
+++ b/crates/ra_arena/src/lib.rs
@@ -4,6 +4,7 @@ use std::{
4 fmt, 4 fmt,
5 marker::PhantomData, 5 marker::PhantomData,
6 ops::{Index, IndexMut}, 6 ops::{Index, IndexMut},
7 iter::FromIterator,
7}; 8};
8 9
9pub mod map; 10pub mod map;
@@ -109,3 +110,15 @@ impl<ID: ArenaId, T> IndexMut<ID> for Arena<ID, T> {
109 &mut self.data[idx] 110 &mut self.data[idx]
110 } 111 }
111} 112}
113
114impl<ID: ArenaId, T> FromIterator<T> for Arena<ID, T> {
115 fn from_iter<I>(iter: I) -> Self
116 where
117 I: IntoIterator<Item = T>,
118 {
119 Arena {
120 data: Vec::from_iter(iter),
121 _ty: PhantomData,
122 }
123 }
124}