Skip to main content

Queryable

Trait Queryable 

Source
pub trait Queryable {
    // Required methods
    fn find(&self) -> FindBuilder<'_>;
    fn find_all(&self) -> FindAllBuilder<'_>;
}
Expand description

Types that expose find() + find_all() queries scoped to themselves.

Implemented by crate::Tab (queries scoped to main frame), crate::Frame (queries scoped to that frame’s contextId), and crate::Element (queries scoped to the element’s subtree). Use this trait when writing helpers that should work against any of the three.

§Examples

use zendriver::Queryable;
async fn first_link<Q: Queryable + Sync>(q: &Q) -> zendriver::Result<zendriver::Element> {
    q.find().css("a").one().await
}

Required Methods§

Source

fn find(&self) -> FindBuilder<'_>

Start a single-element query. See crate::Tab::find for the terminal + modifier surface.

Source

fn find_all(&self) -> FindAllBuilder<'_>

Start a multi-element query. See crate::Tab::find_all for the terminal + modifier surface.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§