[][src]Trait equt_md_ext::MarkdownExt

#[must_use = "iterators are lazy and do nothing unless consumed"]pub trait MarkdownExt<T>: Iterator<Item = T> {
    fn frontmatter(&self) -> Rc<RefCell<Option<FrontMatter>>>;

    fn after<P, F, S, G>(self, after: P, f: F) -> After<Self, F, S, P>
    where
        Self: Sized,
        P: Fn(&T) -> bool,
        S: Iterator<Item = T>,
        G: IntoIterator<Item = T, IntoIter = S>,
        F: Fn(Ref<Option<FrontMatter>>) -> G
, { ... }
fn before<P, F, S, G>(self, before: P, f: F) -> Before<Self, F, S, P>
    where
        Self: Sized,
        P: Fn(&T) -> bool,
        S: Iterator<Item = T>,
        G: IntoIterator<Item = T, IntoIter = S>,
        F: Fn(Ref<Option<FrontMatter>>) -> G
, { ... }
fn link<E>(self, other: E) -> Link<Self, E>
    where
        Self: Sized,
        E: MarkdownExt<T>
, { ... }
fn head<F, G, H>(self, f: F) -> Head<Self, H, F>
    where
        Self: Sized,
        H: Iterator<Item = T>,
        G: IntoIterator<Item = T, IntoIter = H>,
        F: Fn(Ref<Option<FrontMatter>>) -> G
, { ... }
fn tail<F, G, H>(self, f: F) -> Tail<Self, H, F>
    where
        Self: Sized,
        H: Iterator<Item = T>,
        G: IntoIterator<Item = T, IntoIter = H>,
        F: Fn(Ref<Option<FrontMatter>>) -> G
, { ... } }

An interface for extending the original Markdown event iterator.

Required methods

fn frontmatter(&self) -> Rc<RefCell<Option<FrontMatter>>>

Different from a normal iterator, MarkdownExt must own the frontmatter data.

Loading content...

Provided methods

fn after<P, F, S, G>(self, after: P, f: F) -> After<Self, F, S, P> where
    Self: Sized,
    P: Fn(&T) -> bool,
    S: Iterator<Item = T>,
    G: IntoIterator<Item = T, IntoIter = S>,
    F: Fn(Ref<Option<FrontMatter>>) -> G, 

Place pseudo events iterator after the first occurence of a certain event.

f will be called only if after matches. This also helps when the FrontMatter is only available after some point.

fn before<P, F, S, G>(self, before: P, f: F) -> Before<Self, F, S, P> where
    Self: Sized,
    P: Fn(&T) -> bool,
    S: Iterator<Item = T>,
    G: IntoIterator<Item = T, IntoIter = S>,
    F: Fn(Ref<Option<FrontMatter>>) -> G, 

Place pseudo events iterator before the first occurence of a certain event.

f will only be called if before matches. This also helps when the FrontMatter is only available after some point.

Just like the standard chain for iterator, the frontmatter will get transferred

  • If both have frontmatter, the latter one would be picked
  • If neither has frontmatter, it would be None
  • Otherwise, the only frontmatter would be used

fn head<F, G, H>(self, f: F) -> Head<Self, H, F> where
    Self: Sized,
    H: Iterator<Item = T>,
    G: IntoIterator<Item = T, IntoIter = H>,
    F: Fn(Ref<Option<FrontMatter>>) -> G, 

Place events at the begingging.

fn tail<F, G, H>(self, f: F) -> Tail<Self, H, F> where
    Self: Sized,
    H: Iterator<Item = T>,
    G: IntoIterator<Item = T, IntoIter = H>,
    F: Fn(Ref<Option<FrontMatter>>) -> G, 

Place events at the end.

Loading content...

Implementors

impl<'e> MarkdownExt<Event<'e>> for Parser<'e>[src]

impl<A, B, T> MarkdownExt<T> for Link<A, B> where
    A: Iterator<Item = T>,
    B: Iterator<Item = T>, 
[src]

impl<I, H, F, G, T> MarkdownExt<T> for Head<I, H, F> where
    I: Iterator<Item = T>,
    H: Iterator<Item = T>,
    G: IntoIterator<Item = T, IntoIter = H>,
    F: Fn(Ref<Option<FrontMatter>>) -> G, 
[src]

impl<I, H, F, G, T> MarkdownExt<T> for Tail<I, H, F> where
    I: Iterator<Item = T>,
    H: Iterator<Item = T>,
    G: IntoIterator<Item = T, IntoIter = H>,
    F: Fn(Ref<Option<FrontMatter>>) -> G, 
[src]

impl<I, S, G, F, P, T> MarkdownExt<T> for After<I, F, S, P> where
    I: Iterator<Item = T>,
    S: Iterator<Item = T>,
    G: IntoIterator<Item = T, IntoIter = S>,
    F: Fn(Ref<Option<FrontMatter>>) -> G,
    P: Fn(&T) -> bool
[src]

impl<I, S, G, F, P, T> MarkdownExt<T> for Before<I, F, S, P> where
    I: Iterator<Item = T>,
    S: Iterator<Item = T>,
    G: IntoIterator<Item = T, IntoIter = S>,
    F: Fn(Ref<Option<FrontMatter>>) -> G,
    P: Fn(&T) -> bool
[src]

impl<T> MarkdownExt<T> for Bottom<T>[src]

Loading content...