1
0
mirror of https://github.com/nushell/nushell.git synced 2025-05-05 10:34:27 +02:00
nushell/crates/nu-std/std
Bahex 301d1370c4
Add input support to generate ()
- closes  

# Description

This PR adds pipeline input support to `generate`.
- Without input, `generate` keeps its current behavior.
- With input, each invocation of the closure is provided an item from
the input stream as pipeline input (`$in`). If/when the input stream
runs out, `generate` also stops.

Before this PR, there is no filter command that is both stateful _and_
streaming.

This PR also refactors `std/iter scan` to use `generate`, making it
streaming and more performant over larger inputs.

# User-Facing Changes
- `generate` now supports pipeline input, passing each element to the
closure as `$in` until it runs out
- `std/iter scan` is now streaming

# Tests + Formatting
Added tests to validate the new feature.

- 🟢 toolkit fmt
- 🟢 toolkit clippy
- 🟢 toolkit test
- 🟢 toolkit test stdlib

# After Submitting
N/A
2025-01-14 11:44:31 -06:00
..
assert Virtual std module subdirectories () 2024-10-10 06:56:37 -05:00
bench small, backwards compatible enhancements to std () 2025-01-06 11:30:07 -06:00
config Remove unused FlatShapes And/Or () 2024-11-29 22:23:40 +01:00
core update banner command to respect use_ansi_colors () 2024-12-27 07:16:53 -06:00
dirs Fix small typos in std/dirs () 2024-11-23 16:04:27 -06:00
dt Deprecate date to-record and date to-table () 2024-11-29 23:06:26 +01:00
formats fix multiline strings in NDNUON () 2024-12-05 07:53:33 -06:00
help make std help more user friendly () 2024-11-27 09:29:25 +08:00
input Virtual std module subdirectories () 2024-10-10 06:56:37 -05:00
iter Add input support to generate () 2025-01-14 11:44:31 -06:00
log small, backwards compatible enhancements to std () 2025-01-06 11:30:07 -06:00
math Virtual std module subdirectories () 2024-10-10 06:56:37 -05:00
util small, backwards compatible enhancements to std () 2025-01-06 11:30:07 -06:00
xml Virtual std module subdirectories () 2024-10-10 06:56:37 -05:00
mod.nu Always load default env/config values () 2024-11-20 16:15:15 -06:00