Merge pull request #61 from elferherrera/externals

Externals with redirection
This commit is contained in:
JT
2021-09-24 10:26:38 +12:00
committed by GitHub
8 changed files with 298 additions and 17 deletions

View File

@@ -20,6 +20,7 @@ pub enum Type {
ValueStream,
Unknown,
Error,
Binary,
}
impl Display for Type {
@@ -43,6 +44,7 @@ impl Display for Type {
Type::ValueStream => write!(f, "value stream"),
Type::Unknown => write!(f, "unknown"),
Type::Error => write!(f, "error"),
Type::Binary => write!(f, "binary"),
}
}
}

View File

@@ -59,6 +59,10 @@ pub enum Value {
Error {
error: ShellError,
},
Binary {
val: Vec<u8>,
span: Span,
},
}
impl Value {
@@ -83,6 +87,7 @@ impl Value {
Value::Block { span, .. } => *span,
Value::Stream { span, .. } => *span,
Value::Nothing { span, .. } => *span,
Value::Binary { span, .. } => *span,
}
}
@@ -100,6 +105,7 @@ impl Value {
Value::Block { span, .. } => *span = new_span,
Value::Nothing { span, .. } => *span = new_span,
Value::Error { .. } => {}
Value::Binary { span, .. } => *span = new_span,
}
self
@@ -121,6 +127,7 @@ impl Value {
Value::Block { .. } => Type::Block,
Value::Stream { .. } => Type::ValueStream,
Value::Error { .. } => Type::Error,
Value::Binary { .. } => Type::Binary,
}
}
@@ -159,6 +166,7 @@ impl Value {
Value::Block { val, .. } => format!("<Block {}>", val),
Value::Nothing { .. } => String::new(),
Value::Error { error } => format!("{:?}", error),
Value::Binary { val, .. } => format!("{:?}", val),
}
}

View File

@@ -30,8 +30,7 @@ impl Iterator for ValueStream {
fn next(&mut self) -> Option<Self::Item> {
{
let mut iter = self.0.borrow_mut();
iter.next()
self.0.borrow_mut().next()
}
}
}