Fix sync.

This commit is contained in:
Stephen Chung
2022-08-22 14:02:24 +08:00
parent 799dd9d9d1
commit db865d7538
2 changed files with 40 additions and 24 deletions

View File

@@ -292,7 +292,7 @@ impl Engine {
.set_custom_type_raw(fully_qualified_type_path, name);
self
}
/// Register an type iterator for an iterable type with the [`Engine`].
/// Register a type iterator for an iterable type with the [`Engine`].
/// This is an advanced API.
#[inline(always)]
pub fn register_iterator<T>(&mut self) -> &mut Self
@@ -303,6 +303,17 @@ impl Engine {
self.global_namespace_mut().set_iterable::<T>();
self
}
/// Register a fallible type iterator for an iterable type with the [`Engine`].
/// This is an advanced API.
#[inline(always)]
pub fn register_iterator_result<T, X>(&mut self) -> &mut Self
where
T: Variant + Clone + IntoIterator<Item = RhaiResultOf<X>>,
X: Variant + Clone,
{
self.global_namespace_mut().set_iterable_result::<T, X>();
self
}
/// Register a getter function for a member of a registered type with the [`Engine`].
///
/// The function signature must start with `&mut self` and not `&self`.