mirror of
https://github.com/nushell/nushell
synced 2025-01-10 04:09:09 +00:00
20 lines
543 B
Rust
20 lines
543 B
Rust
|
use std::fmt::Debug;
|
||
|
|
||
|
/// A combination of an informative parse error, and what has been successfully parsed so far
|
||
|
#[derive(Debug)]
|
||
|
pub struct ParseError<T: Debug> {
|
||
|
/// An informative cause for this parse error
|
||
|
pub(crate) cause: nu_errors::ParseError,
|
||
|
|
||
|
/// What has been successfully parsed, if anything
|
||
|
pub(crate) partial: Option<T>,
|
||
|
}
|
||
|
|
||
|
pub type ParseResult<T> = Result<T, ParseError<T>>;
|
||
|
|
||
|
impl<T: Debug> From<ParseError<T>> for nu_errors::ShellError {
|
||
|
fn from(e: ParseError<T>) -> Self {
|
||
|
e.cause.into()
|
||
|
}
|
||
|
}
|