[build] Implement registers code generation in the Rust meta crate;
This commit is contained in:
committed by
Dan Gohman
parent
4f2d7dd54f
commit
b7f2acf0ea
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user