From 74beb5bfcbc33d6232a9b08b4df4bcfd781790e9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 10:29:00 +0300 Subject: simplify --- crates/ra_arena/src/map.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/ra_arena') diff --git a/crates/ra_arena/src/map.rs b/crates/ra_arena/src/map.rs index 2f09d677f..be80edaf3 100644 --- a/crates/ra_arena/src/map.rs +++ b/crates/ra_arena/src/map.rs @@ -29,6 +29,10 @@ impl ArenaMap { self.v.get(Self::to_idx(id)).and_then(|it| it.as_ref()) } + pub fn get_mut(&mut self, id: ID) -> Option<&mut T> { + self.v.get_mut(Self::to_idx(id)).and_then(|it| it.as_mut()) + } + pub fn values(&self) -> impl Iterator { self.v.iter().filter_map(|o| o.as_ref()) } -- cgit v1.2.3