pub struct ConsumeError { /* private fields */ }
Expand description
A list of errors that occured while consuming from a source
.
Implementations§
Source§impl ConsumeError
impl ConsumeError
Sourcepub fn new() -> ConsumeError
pub fn new() -> ConsumeError
Create a new empty ConsumeError
.
Sourcepub fn new_with(cause: ConsumeErrorType) -> ConsumeError
pub fn new_with(cause: ConsumeErrorType) -> ConsumeError
Create a new ConsumeError
containing only cause
.
Sourcepub fn new_from(causes: Vec<ConsumeErrorType>) -> ConsumeError
pub fn new_from(causes: Vec<ConsumeErrorType>) -> ConsumeError
Create a new ConsumeError
containing causes
.
Sourcepub fn offset(self, by: usize) -> Self
pub fn offset(self, by: usize) -> Self
Mutate all the errors to move the utf-8 character index at which they were caused by by
.
§Examples
use manger::{ ConsumeError, ConsumeErrorType::* };
assert_eq!(
ConsumeError::new_from(
vec![
InvalidValue { index: 0 },
InsufficientTokens { index: 5 }
]
).offset(2),
ConsumeError::new_from(
vec![
InvalidValue { index: 2 },
InsufficientTokens { index: 7 }
]
)
);
Sourcepub fn into_causes(self) -> Vec<ConsumeErrorType>
pub fn into_causes(self) -> Vec<ConsumeErrorType>
Fetch a vector of the causes of this error.
This consume ownership of the error.
Sourcepub fn causes(&self) -> Vec<&ConsumeErrorType>
pub fn causes(&self) -> Vec<&ConsumeErrorType>
Fetch a vector of references to the causes of this error.
Sourcepub fn add_cause(&mut self, cause: ConsumeErrorType)
pub fn add_cause(&mut self, cause: ConsumeErrorType)
Pushes an extra cause for this error.
Sourcepub fn add_causes(&mut self, other_err: ConsumeError)
pub fn add_causes(&mut self, other_err: ConsumeError)
Pushes all the causes for other_err
for this error.
Trait Implementations§
Source§impl Debug for ConsumeError
impl Debug for ConsumeError
Source§impl PartialEq for ConsumeError
impl PartialEq for ConsumeError
impl StructuralPartialEq for ConsumeError
Auto Trait Implementations§
impl Freeze for ConsumeError
impl RefUnwindSafe for ConsumeError
impl Send for ConsumeError
impl Sync for ConsumeError
impl Unpin for ConsumeError
impl UnwindSafe for ConsumeError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more