mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 05:48:49 +02:00
Remove ListStream
type (#14425)
# Description List values and list streams have the same type (`list<>`). Rather, streaming is a separate property of the pipeline/command output. This PR removes the unnecessary `ListStream` type. # User-Facing Changes Should be none, except `random dice` now has a more specific output type.
This commit is contained in:
@ -109,7 +109,7 @@ impl PipelineData {
|
||||
/// than would be returned by [`Value::get_type()`] on the result of
|
||||
/// [`.into_value()`](Self::into_value).
|
||||
///
|
||||
/// Specifically, a `ListStream` results in [`list stream`](Type::ListStream) rather than
|
||||
/// Specifically, a `ListStream` results in `list<any>` rather than
|
||||
/// the fully complete [`list`](Type::List) type (which would require knowing the contents),
|
||||
/// and a `ByteStream` with [unknown](crate::ByteStreamType::Unknown) type results in
|
||||
/// [`any`](Type::Any) rather than [`string`](Type::String) or [`binary`](Type::Binary).
|
||||
@ -117,7 +117,7 @@ impl PipelineData {
|
||||
match self {
|
||||
PipelineData::Empty => Type::Nothing,
|
||||
PipelineData::Value(value, _) => value.get_type(),
|
||||
PipelineData::ListStream(_, _) => Type::ListStream,
|
||||
PipelineData::ListStream(_, _) => Type::list(Type::Any),
|
||||
PipelineData::ByteStream(stream, _) => stream.type_().into(),
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ pub enum Type {
|
||||
Float,
|
||||
Int,
|
||||
List(Box<Type>),
|
||||
ListStream,
|
||||
#[default]
|
||||
Nothing,
|
||||
Number,
|
||||
@ -121,7 +120,6 @@ impl Type {
|
||||
Type::Nothing => SyntaxShape::Nothing,
|
||||
Type::Record(entries) => SyntaxShape::Record(mk_shape(entries)),
|
||||
Type::Table(columns) => SyntaxShape::Table(mk_shape(columns)),
|
||||
Type::ListStream => SyntaxShape::List(Box::new(SyntaxShape::Any)),
|
||||
Type::Any => SyntaxShape::Any,
|
||||
Type::Error => SyntaxShape::Any,
|
||||
Type::Binary => SyntaxShape::Binary,
|
||||
@ -151,7 +149,6 @@ impl Type {
|
||||
Type::Nothing => String::from("nothing"),
|
||||
Type::Number => String::from("number"),
|
||||
Type::String => String::from("string"),
|
||||
Type::ListStream => String::from("list-stream"),
|
||||
Type::Any => String::from("any"),
|
||||
Type::Error => String::from("error"),
|
||||
Type::Binary => String::from("binary"),
|
||||
@ -209,7 +206,6 @@ impl Display for Type {
|
||||
Type::Nothing => write!(f, "nothing"),
|
||||
Type::Number => write!(f, "number"),
|
||||
Type::String => write!(f, "string"),
|
||||
Type::ListStream => write!(f, "list-stream"),
|
||||
Type::Any => write!(f, "any"),
|
||||
Type::Error => write!(f, "error"),
|
||||
Type::Binary => write!(f, "binary"),
|
||||
|
Reference in New Issue
Block a user