Query

Trait Query 

Source
pub trait Query {
    // Required methods
    fn find_all_inlines<F>(&self, predicate: F) -> Vec<&Inline>
       where F: Fn(&Inline) -> bool;
    fn find_all_blocks<F>(&self, predicate: F) -> Vec<&Block>
       where F: Fn(&Block) -> bool;
    fn find_first_inline<F>(&self, predicate: F) -> Option<&Inline>
       where F: Fn(&Inline) -> bool;
    fn find_first_block<F>(&self, predicate: F) -> Option<&Block>
       where F: Fn(&Block) -> bool;

    // Provided methods
    fn count_inlines<F>(&self, predicate: F) -> usize
       where F: Fn(&Inline) -> bool { ... }
    fn count_blocks<F>(&self, predicate: F) -> usize
       where F: Fn(&Block) -> bool { ... }
    fn any_inline<F>(&self, predicate: F) -> bool
       where F: Fn(&Inline) -> bool { ... }
    fn any_block<F>(&self, predicate: F) -> bool
       where F: Fn(&Block) -> bool { ... }
}
Expand description

Query trait for finding elements in AST structures

Required Methods§

Source

fn find_all_inlines<F>(&self, predicate: F) -> Vec<&Inline>
where F: Fn(&Inline) -> bool,

Find all inline elements matching a predicate

Source

fn find_all_blocks<F>(&self, predicate: F) -> Vec<&Block>
where F: Fn(&Block) -> bool,

Find all block elements matching a predicate

Source

fn find_first_inline<F>(&self, predicate: F) -> Option<&Inline>
where F: Fn(&Inline) -> bool,

Find the first inline element matching a predicate

Source

fn find_first_block<F>(&self, predicate: F) -> Option<&Block>
where F: Fn(&Block) -> bool,

Find the first block element matching a predicate

Provided Methods§

Source

fn count_inlines<F>(&self, predicate: F) -> usize
where F: Fn(&Inline) -> bool,

Count inline elements matching a predicate

Source

fn count_blocks<F>(&self, predicate: F) -> usize
where F: Fn(&Block) -> bool,

Count block elements matching a predicate

Source

fn any_inline<F>(&self, predicate: F) -> bool
where F: Fn(&Inline) -> bool,

Check if any inline element matches a predicate

Source

fn any_block<F>(&self, predicate: F) -> bool
where F: Fn(&Block) -> bool,

Check if any block element matches a predicate

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Query for Vec<Inline>

Source§

fn find_all_inlines<F>(&self, predicate: F) -> Vec<&Inline>
where F: Fn(&Inline) -> bool,

Source§

fn find_all_blocks<F>(&self, _predicate: F) -> Vec<&Block>
where F: Fn(&Block) -> bool,

Source§

fn find_first_inline<F>(&self, predicate: F) -> Option<&Inline>
where F: Fn(&Inline) -> bool,

Source§

fn find_first_block<F>(&self, _predicate: F) -> Option<&Block>
where F: Fn(&Block) -> bool,

Implementors§