Simplify iterator registration.

This commit is contained in:
Stephen Chung
2020-10-15 22:11:18 +08:00
parent ea9ef1091a
commit 3b99b8f166
5 changed files with 27 additions and 36 deletions

View File

@@ -177,10 +177,12 @@ impl Engine {
/// Register an iterator adapter for an iterable type with the `Engine`.
/// This is an advanced feature.
#[inline(always)]
pub fn register_iterator<T: Variant + Clone + IntoIterator<Item = U>, U: Variant + Clone>(
&mut self,
) -> &mut Self {
self.global_module.set_iterable::<T, U>();
pub fn register_iterator<T>(&mut self) -> &mut Self
where
T: Variant + Clone + Iterator,
<T as Iterator>::Item: Variant + Clone,
{
self.global_module.set_iterable::<T>();
self
}