nushell/crates/nu-command/tests/format_conversions
Devyn Cairns b06f31d3c6
Make from json --objects streaming (#12949)
# Description

Makes the `from json --objects` command produce a stream, and read
lazily from an input stream to produce its output.

Also added a helper, `PipelineData::get_type()`, to make it easier to
construct a wrong type error message when matching on `PipelineData`. I
expect checking `PipelineData` for either a string value or an `Unknown`
or `String` typed `ByteStream` will be very, very common. I would have
liked to have a helper that just returns a readable stream from either,
but that would either be a bespoke enum or a `Box<dyn BufRead>`, which
feels like it wouldn't be so great for performance. So instead, taking
the approach I did here is probably better - having a function that
accepts the `impl BufRead` and matching to use it.

# User-Facing Changes

- `from json --objects` no longer collects its input, and can be used
for large datasets or streams that produce values over time.

# Tests + Formatting
All passing.

# After Submitting
- [ ] release notes

---------

Co-authored-by: Ian Manske <ian.manske@pm.me>
2024-05-24 23:37:50 +00:00
..
csv.rs Replace ExternalStream with new ByteStream type (#12774) 2024-05-16 07:11:18 -07:00
html.rs Remove feat extra and include in default (#12140) 2024-03-10 17:29:02 +01:00
json.rs Make from json --objects streaming (#12949) 2024-05-24 23:37:50 +00:00
markdown.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
mod.rs Msgpack commands (#12664) 2024-04-26 06:23:16 -05:00
msgpack.rs Msgpack commands (#12664) 2024-04-26 06:23:16 -05:00
msgpackz.rs Msgpack commands (#12664) 2024-04-26 06:23:16 -05:00
nuon.rs Deprecate register and add plugin use (#12607) 2024-04-23 06:37:50 -05:00
ods.rs Add long options for formats (#10645) 2023-10-08 19:07:09 +02:00
ssv.rs Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
toml.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
tsv.rs Replace ExternalStream with new ByteStream type (#12774) 2024-05-16 07:11:18 -07:00
url.rs Rename to url command to url build-query (#7702) 2023-01-15 10:16:29 -08:00
xlsx.rs Add date support in from xlsx (#11952) 2024-02-24 07:25:51 -06:00
xml.rs Add self-closed tag support for to xml (#11577) 2024-01-19 05:35:29 -06:00
yaml.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00