pub enum ElementBehavior<ELT> {
Parse,
Ignore,
Skip,
Map(Rc<RefCell<Box<dyn FnMut(ELT) -> ELT>>>),
FlatMap(Rc<RefCell<Box<dyn FnMut(ELT) -> Vec<ELT>>>>),
}Expand description
Behavior of the parser when encountering certain elements.
Variants§
Parse
The parser will parse the element normally.
Ignore
The parser will ignore the element and not parse it. In this case, alternative parsers will be tried.
Skip
Parse element but do not include it in the output.
Map(Rc<RefCell<Box<dyn FnMut(ELT) -> ELT>>>)
Parse the element and apply a custom function to it.
FlatMap(Rc<RefCell<Box<dyn FnMut(ELT) -> Vec<ELT>>>>)
Parse the element and apply a custom function to it which returns an array of elements.
Trait Implementations§
Source§impl<ELT: Clone> Clone for ElementBehavior<ELT>
impl<ELT: Clone> Clone for ElementBehavior<ELT>
Source§fn clone(&self) -> ElementBehavior<ELT>
fn clone(&self) -> ElementBehavior<ELT>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<ELT> Freeze for ElementBehavior<ELT>
impl<ELT> !RefUnwindSafe for ElementBehavior<ELT>
impl<ELT> !Send for ElementBehavior<ELT>
impl<ELT> !Sync for ElementBehavior<ELT>
impl<ELT> Unpin for ElementBehavior<ELT>
impl<ELT> !UnwindSafe for ElementBehavior<ELT>
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