Skip to main content

ParserCallbacks

Trait ParserCallbacks 

Source
pub trait ParserCallbacks<'input> {
    // Provided method
    fn handle_broken_link(
        &mut self,
        link: BrokenLink<'input>,
    ) -> Option<(CowStr<'input>, CowStr<'input>)> { ... }
}
Expand description

Trait to customize Parser behavior with callbacks. See Parser::new_with_callbacks.

All methods have a default implementation, so you can choose which ones to override.

Provided Methods§

Potentially provide a custom definition for a broken link.

In case the parser encounters any potential links that have a broken reference (e.g [foo] when there is no [foo]: entry at the bottom) this callback will be called with information about the reference, and the returned pair will be used as the link URL and title if it is not None.

Trait Implementations§

Source§

impl<'input> ParserCallbacks<'input> for Box<dyn ParserCallbacks<'input>>

Potentially provide a custom definition for a broken link. Read more

Implementations on Foreign Types§

Source§

impl<'input> ParserCallbacks<'input> for Box<dyn ParserCallbacks<'input>>

Implementors§

Source§

impl<'input> ParserCallbacks<'input> for DefaultParserCallbacks

Source§

impl<'input, F> ParserCallbacks<'input> for BrokenLinkCallback<F>
where F: FnMut(BrokenLink<'input>) -> Option<(CowStr<'input>, CowStr<'input>)>,