Scope implements IntoIterator.
This commit is contained in:
parent
61d7356e08
commit
7b8322b6e1
@ -12,8 +12,10 @@ Bug fixes
|
|||||||
Enhancements
|
Enhancements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
* Comparisons between `FLOAT`/[`Decimal`](https://crates.io/crates/rust_decimal) and `INT` are now built in.
|
||||||
* Error position in `eval` statements is now wrapped in an `EvalAltResult::ErrorInFunctionCall`.
|
* Error position in `eval` statements is now wrapped in an `EvalAltResult::ErrorInFunctionCall`.
|
||||||
* `Position` now implements `Add` and `AddAssign`.
|
* `Position` now implements `Add` and `AddAssign`.
|
||||||
|
* `Scope` now implements `IntoIterator`.
|
||||||
|
|
||||||
|
|
||||||
Version 0.19.12
|
Version 0.19.12
|
||||||
@ -54,7 +56,7 @@ Enhancements
|
|||||||
|
|
||||||
* Functions resolution cache is used in more cases, making repeated function calls faster.
|
* Functions resolution cache is used in more cases, making repeated function calls faster.
|
||||||
* Added `atan(x, y)` and `hypot(x, y)` to `BasicMathPackage`.
|
* Added `atan(x, y)` and `hypot(x, y)` to `BasicMathPackage`.
|
||||||
* Added standard arithmetic operators between `FLOAT` and `INT`.
|
* Added standard arithmetic operators between `FLOAT`/[`Decimal`](https://crates.io/crates/rust_decimal) and `INT`.
|
||||||
|
|
||||||
|
|
||||||
Version 0.19.11
|
Version 0.19.11
|
||||||
|
14
src/scope.rs
14
src/scope.rs
@ -64,6 +64,20 @@ impl Default for Scope<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> IntoIterator for Scope<'a> {
|
||||||
|
type Item = (Cow<'a, str>, Dynamic);
|
||||||
|
type IntoIter = Box<dyn Iterator<Item = Self::Item> + 'a>;
|
||||||
|
|
||||||
|
fn into_iter(self) -> Self::IntoIter {
|
||||||
|
Box::new(
|
||||||
|
self.values
|
||||||
|
.into_iter()
|
||||||
|
.zip(self.names.into_iter())
|
||||||
|
.map(|(value, (name, _))| (name, value)),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> Scope<'a> {
|
impl<'a> Scope<'a> {
|
||||||
/// Create a new [`Scope`].
|
/// Create a new [`Scope`].
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user