Avoid copying iterator sources.
This commit is contained in:
@@ -19,14 +19,9 @@ where
|
||||
{
|
||||
lib.type_iterators.insert(
|
||||
TypeId::of::<Range<T>>(),
|
||||
Box::new(|source: &Dynamic| {
|
||||
Box::new(
|
||||
source
|
||||
.downcast_ref::<Range<T>>()
|
||||
.cloned()
|
||||
.unwrap()
|
||||
.map(|x| x.into_dynamic()),
|
||||
) as Box<dyn Iterator<Item = Dynamic>>
|
||||
Box::new(|source: Dynamic| {
|
||||
Box::new(source.cast::<Range<T>>().map(|x| x.into_dynamic()))
|
||||
as Box<dyn Iterator<Item = Dynamic>>
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -64,14 +59,9 @@ where
|
||||
{
|
||||
lib.type_iterators.insert(
|
||||
TypeId::of::<StepRange<T>>(),
|
||||
Box::new(|source: &Dynamic| {
|
||||
Box::new(
|
||||
source
|
||||
.downcast_ref::<StepRange<T>>()
|
||||
.cloned()
|
||||
.unwrap()
|
||||
.map(|x| x.into_dynamic()),
|
||||
) as Box<dyn Iterator<Item = Dynamic>>
|
||||
Box::new(|source: Dynamic| {
|
||||
Box::new(source.cast::<StepRange<T>>().map(|x| x.into_dynamic()))
|
||||
as Box<dyn Iterator<Item = Dynamic>>
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user