Add Module::combine.
This commit is contained in:
parent
a5b4d61dff
commit
489b1ca00e
@ -8,6 +8,7 @@ New features
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
* Adds `Engine::register_get_result`, `Engine::register_set_result`, `Engine::register_indexer_get_result`, `Engine::register_indexer_set_result` API.
|
* Adds `Engine::register_get_result`, `Engine::register_set_result`, `Engine::register_indexer_get_result`, `Engine::register_indexer_set_result` API.
|
||||||
|
* Adds `Module::combine` to combine two modules.
|
||||||
|
|
||||||
|
|
||||||
Version 0.18.1
|
Version 0.18.1
|
||||||
|
@ -928,6 +928,18 @@ impl Module {
|
|||||||
self.all_functions.get(&hash_qualified_fn)
|
self.all_functions.get(&hash_qualified_fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Combine another module into this module.
|
||||||
|
/// The other module is consumed to merge into this module.
|
||||||
|
pub fn combine(&mut self, other: Self) -> &mut Self {
|
||||||
|
self.variables.extend(other.variables.into_iter());
|
||||||
|
self.functions.extend(other.functions.into_iter());
|
||||||
|
self.type_iterators.extend(other.type_iterators.into_iter());
|
||||||
|
self.all_functions.clear();
|
||||||
|
self.all_variables.clear();
|
||||||
|
self.indexed = false;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Merge another module into this module.
|
/// Merge another module into this module.
|
||||||
pub fn merge(&mut self, other: &Self) -> &mut Self {
|
pub fn merge(&mut self, other: &Self) -> &mut Self {
|
||||||
self.merge_filtered(other, |_, _, _| true)
|
self.merge_filtered(other, |_, _, _| true)
|
||||||
|
Loading…
Reference in New Issue
Block a user