Skip to content

Commit

Permalink
Merge pull request #682 from epage/res
Browse files Browse the repository at this point in the history
refactor(error): Emphasize PResult over IResult
  • Loading branch information
epage authored Jan 10, 2025
2 parents 24d7b5b + 318d547 commit 87b491b
Showing 1 changed file with 9 additions and 9 deletions.
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

0 comments on commit 87b491b

Please sign in to comment.