[build] Implement registers code generation in the Rust meta crate;

This commit is contained in:
Benjamin Bouvier
2018-10-16 16:42:40 +02:00
committed by Dan Gohman
parent 4f2d7dd54f
commit b7f2acf0ea
15 changed files with 714 additions and 51 deletions

View File

@@ -50,6 +50,11 @@ where
self.elems.get(k.index())
}
/// Get the element at `k` if it exists, mutable version.
pub fn get_mut(&mut self, k: K) -> Option<&mut V> {
self.elems.get_mut(k.index())
}
/// Is this map completely empty?
pub fn is_empty(&self) -> bool {
self.elems.is_empty()
@@ -101,6 +106,11 @@ where
self.elems.push(v);
k
}
/// Returns the last element that was inserted in the map.
pub fn last(&self) -> Option<&V> {
self.elems.last()
}
}
/// Immutable indexing into an `PrimaryMap`.