Rename IoStream to OutDest (#12433)

# Description
I spent a while trying to come up with a good name for what is currently
`IoStream`. Looking back, this name is not the best, because it:
1. Implies that it is a stream, when it all it really does is specify
the output destination for a stream/pipeline.
2. Implies that it handles input and output, when it really only handles
output.

So, this PR renames `IoStream` to `OutDest` instead, which should be
more clear.
This commit is contained in:
Ian Manske
2024-04-09 16:48:32 +00:00
committed by GitHub
parent 6536fa5ff7
commit d7ba8872bf
28 changed files with 263 additions and 260 deletions

View File

@ -40,7 +40,7 @@ impl Command for Collect {
let block = engine_state.get_block(capture_block.block_id).clone();
let mut stack_captures =
stack.captures_to_stack_preserve_stdio(capture_block.captures.clone());
stack.captures_to_stack_preserve_out_dest(capture_block.captures.clone());
let metadata = input.metadata();
let input: Value = input.into_value(call.head);

View File

@ -1,5 +1,5 @@
use nu_engine::{command_prelude::*, get_eval_block_with_early_return, redirect_env};
use nu_protocol::{engine::Closure, IoStream, ListStream, RawStream};
use nu_protocol::{engine::Closure, ListStream, OutDest, RawStream};
use std::thread;
#[derive(Clone)]
@ -72,7 +72,7 @@ impl Command for Do {
let capture_errors = call.has_flag(engine_state, caller_stack, "capture-errors")?;
let has_env = call.has_flag(engine_state, caller_stack, "env")?;
let mut callee_stack = caller_stack.captures_to_stack_preserve_stdio(block.captures);
let mut callee_stack = caller_stack.captures_to_stack_preserve_out_dest(block.captures);
let block = engine_state.get_block(block.block_id);
bind_args_to(&mut callee_stack, &block.signature, rest, call.head)?;
@ -191,7 +191,7 @@ impl Command for Do {
metadata,
trim_end_newline,
}) if ignore_program_errors
&& !matches!(caller_stack.stdout(), IoStream::Pipe | IoStream::Capture) =>
&& !matches!(caller_stack.stdout(), OutDest::Pipe | OutDest::Capture) =>
{
Ok(PipelineData::ExternalStream {
stdout,

View File

@ -1,5 +1,5 @@
use nu_engine::command_prelude::*;
use nu_protocol::{engine::StateWorkingSet, IoStream};
use nu_protocol::{engine::StateWorkingSet, OutDest};
#[derive(Clone)]
pub struct Ignore;
@ -56,8 +56,8 @@ impl Command for Ignore {
}]
}
fn stdio_redirect(&self) -> (Option<IoStream>, Option<IoStream>) {
(Some(IoStream::Null), None)
fn pipe_redirection(&self) -> (Option<OutDest>, Option<OutDest>) {
(Some(OutDest::Null), None)
}
}

View File

@ -80,7 +80,7 @@ impl Command for LazyMake {
}
}
let stack = stack.clone().reset_stdio().capture();
let stack = stack.clone().reset_out_dest().capture();
Ok(Value::lazy_record(
Box::new(NuLazyRecord {