I'm gonna use a VecDeque now instead of trying to get async streams working to make progress, but the intent is that we should be able to use async streams in and out to interleave the work better.
32 lines
693 B
Rust
32 lines
693 B
Rust
use crate::Value;
|
|
use derive_new::new;
|
|
|
|
#[derive(Debug, new)]
|
|
pub struct ShellError {
|
|
title: String,
|
|
error: Value,
|
|
}
|
|
|
|
impl ShellError {
|
|
crate fn string(title: impl Into<String>) -> ShellError {
|
|
ShellError::new(title.into(), Value::nothing())
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for ShellError {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
|
write!(f, "{}", &self.title)
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for ShellError {}
|
|
|
|
impl std::convert::From<std::io::Error> for ShellError {
|
|
fn from(input: std::io::Error) -> ShellError {
|
|
ShellError {
|
|
title: format!("{}", input),
|
|
error: Value::nothing(),
|
|
}
|
|
}
|
|
}
|