pub struct Sublist<'a, E, MapFn, Parent, ParentErr>{ /* private fields */ }
Expand description
A sublist that maps a list of errors into a parent error type
When an object of this type is dropped, it will call the given MapFn
object with a
ErrorList<E>
containing all the errors that were pushed into it. The map
function will be used to map that error list to a single ParentErr
object which will then
be pushed onto the parent’s error list.
This type implements DerefMut to an ErrorList, so it can basically be thought of as an ErrorList with a fancy destructor.
Implementations§
Source§impl<'a, E, MapFn, Parent, ParentErr> Sublist<'a, E, MapFn, Parent, ParentErr>
impl<'a, E, MapFn, Parent, ParentErr> Sublist<'a, E, MapFn, Parent, ParentErr>
Sourcepub fn new(map_fn: MapFn, parent: &'a mut Parent) -> Self
pub fn new(map_fn: MapFn, parent: &'a mut Parent) -> Self
Create a new sublist that maps a list of subfunction errors to the parent error
map_fn
is a function that accepts an ErrorList<E>
and returns a ParentErr
, which
is then pushed into the parent’s error list.
It is recommended use WriteErrorList::sublist instead of this.
Methods from Deref<Target = ErrorList<E>>§
Trait Implementations§
Source§impl<'a, E, MapFn, Parent, ParentErr> WriteErrorList<E> for Sublist<'a, E, MapFn, Parent, ParentErr>
impl<'a, E, MapFn, Parent, ParentErr> WriteErrorList<E> for Sublist<'a, E, MapFn, Parent, ParentErr>
Source§fn subwriter<'sub, SubMapFn, SubErr: 'sub>(
&'sub mut self,
map_fn: SubMapFn,
) -> impl WriteErrorList<SubErr> + 'sub
fn subwriter<'sub, SubMapFn, SubErr: 'sub>( &'sub mut self, map_fn: SubMapFn, ) -> impl WriteErrorList<SubErr> + 'sub
Create a new mapping error writer with this as its parent Read more
Auto Trait Implementations§
impl<'a, E, MapFn, Parent, ParentErr> Freeze for Sublist<'a, E, MapFn, Parent, ParentErr>where
MapFn: Freeze,
impl<'a, E, MapFn, Parent, ParentErr> RefUnwindSafe for Sublist<'a, E, MapFn, Parent, ParentErr>
impl<'a, E, MapFn, Parent, ParentErr> Send for Sublist<'a, E, MapFn, Parent, ParentErr>
impl<'a, E, MapFn, Parent, ParentErr> Sync for Sublist<'a, E, MapFn, Parent, ParentErr>
impl<'a, E, MapFn, Parent, ParentErr> Unpin for Sublist<'a, E, MapFn, Parent, ParentErr>
impl<'a, E, MapFn, Parent, ParentErr> !UnwindSafe for Sublist<'a, E, MapFn, Parent, ParentErr>
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