#![feature(round_char_boundary)]
#![warn(missing_docs)]
#![doc = include_str!("../readme.md")]
pub mod byte;
pub mod parser;
pub mod pipe;
pub mod str;
mod tag;
mod take;
pub use self::{pipe::*, tag::*, take::*};
use fatal_error::{FatalError, NeverErr};
pub type Result<R, O, E> = std::result::Result<(R, O), FatalError<E>>;
pub trait Pipe<I, O, E = NeverErr, R = I> {
fn apply(&mut self, input: I) -> Result<R, O, E>;
}
impl<I, O, E, R, F> Pipe<I, O, E, R> for F
where
F: FnMut(I) -> Result<R, O, E>,
{
fn apply(&mut self, input: I) -> Result<R, O, E> { (self)(input) }
}
impl<I, E> Pipe<I, (), E> for () {
fn apply(&mut self, input: I) -> Result<I, (), E> { Ok((input, ())) }
}