use crate::error::InternalRsonpathError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum InputError {
#[error("owned buffer size exceeded the hard system limit of isize::MAX")]
AllocationSizeExceeded,
#[error(transparent)]
IoError(#[from] std::io::Error),
#[error("InputError: {0}")]
InternalError(
#[source]
#[from]
InternalRsonpathError,
),
}
pub(crate) trait InputErrorConvertible<T>: Sized {
fn e(self) -> Result<T, InputError>;
}
impl<T, E: Into<InputError>> InputErrorConvertible<T> for Result<T, E> {
#[inline(always)]
fn e(self) -> Result<T, InputError> {
self.map_err(std::convert::Into::into)
}
}
#[derive(Debug, Error)]
pub enum Infallible {}
impl From<Infallible> for InputError {
#[inline(always)]
fn from(_value: Infallible) -> Self {
unreachable!()
}
}