Query

Trait Query 

Source
pub trait Query {
Show 17 methods // 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 { ... } fn find_all_links(&self) -> Vec<&Link> { ... } fn find_all_images(&self) -> Vec<&Image> { ... } fn find_all_headings(&self) -> Vec<&Heading> { ... } fn find_all_autolinks(&self) -> Vec<&str> { ... } fn find_all_text(&self) -> Vec<&str> { ... } fn find_all_code_spans(&self) -> Vec<&str> { ... } fn find_all_code_blocks(&self) -> Vec<&CodeBlock> { ... } fn find_all_tables(&self) -> Vec<&Table> { ... } fn find_all_lists(&self) -> Vec<&List> { ... }
}
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

Find all links in the document

Source

fn find_all_images(&self) -> Vec<&Image>

Find all images in the document

Source

fn find_all_headings(&self) -> Vec<&Heading>

Find all headings in the document

Find all autolinks in the document

Source

fn find_all_text(&self) -> Vec<&str>

Find all text nodes in the document

Source

fn find_all_code_spans(&self) -> Vec<&str>

Find all code spans in the document

Source

fn find_all_code_blocks(&self) -> Vec<&CodeBlock>

Find all code blocks in the document

Source

fn find_all_tables(&self) -> Vec<&Table>

Find all tables in the document

Source

fn find_all_lists(&self) -> Vec<&List>

Find all lists in the document

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§