Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(error): Emphasize PResult over IResult #682

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,30 @@ use crate::stream::Stream;
#[allow(unused_imports)] // Here for intra-doc links
use crate::Parser;

/// For use with [`Parser::parse_peek`] which allows the input stream to be threaded through a
/// parser.
/// For use with [`Parser::parse_next`]
///
/// - `Ok((I, O))` is the remaining [input][crate::stream] and the parsed value
/// - `Ok(O)` is the parsed value
/// - [`Err(ErrMode<E>)`][ErrMode] is the error along with how to respond to it
///
/// By default, the error type (`E`) is [`InputError`]
/// By default, the error type (`E`) is [`ContextError`].
///
/// When integrating into the result of the application, see
/// - [`Parser::parse`]
/// - [`ErrMode::into_inner`]
pub type IResult<I, O, E = InputError<I>> = PResult<(I, O), E>;
pub type PResult<O, E = ContextError> = Result<O, ErrMode<E>>;

/// For use with [`Parser::parse_next`]
/// For use with [`Parser::parse_peek`] which allows the input stream to be threaded through a
/// parser.
///
/// - `Ok(O)` is the parsed value
/// - `Ok((I, O))` is the remaining [input][crate::stream] and the parsed value
/// - [`Err(ErrMode<E>)`][ErrMode] is the error along with how to respond to it
///
/// By default, the error type (`E`) is [`ContextError`].
/// By default, the error type (`E`) is [`InputError`]
///
/// When integrating into the result of the application, see
/// - [`Parser::parse`]
/// - [`ErrMode::into_inner`]
pub type PResult<O, E = ContextError> = Result<O, ErrMode<E>>;
pub type IResult<I, O, E = InputError<I>> = PResult<(I, O), E>;

/// Contains information on needed data if a parser returned `Incomplete`
///
Expand Down
Loading