Skip to main content

TargetProvider

Trait TargetProvider 

Source
pub trait TargetProvider: Send + Sync {
    // Required methods
    fn list_targets(&self) -> Vec<TargetInfo>;
    fn create_target(&self, url: &str) -> Result<TargetInfo, String>;
    fn close_target(&self, target_id: &str) -> Result<(), String>;
    fn activate_target(&self, target_id: &str) -> Result<(), String>;
}
Expand description

Browser target manager trait. Implemented by the backend (e.g. bao_cdp) to provide target discovery/creation/closure.

Constraints: Send + Sync.

Required Methods§

Source

fn list_targets(&self) -> Vec<TargetInfo>

List all available browser targets.

Source

fn create_target(&self, url: &str) -> Result<TargetInfo, String>

Create a new target (open a new page).

Source

fn close_target(&self, target_id: &str) -> Result<(), String>

Close the specified target.

Source

fn activate_target(&self, target_id: &str) -> Result<(), String>

Activate (bring to front) the specified target.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§