Skip to main content

PluginExtractionPort

Trait PluginExtractionPort 

Source
pub trait PluginExtractionPort: Send + Sync {
    // Required method
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ExtractionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ExtractionResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn validate_selector<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _html: &'life1 str,
        _selector_expr: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(bool, usize)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Port for executing data extraction on a page

Implementations handle DOM interaction (via browser automation or plugin content script).

§Example

use stygian_plugin::ports::PluginExtractionPort;
use stygian_plugin::domain::{ExtractionRequest, ExtractionTemplate};
let template = ExtractionTemplate::new("Example");
let request = ExtractionRequest::new(template, "https://example.com", "<html>...</html>");
let result = port.execute(&request).await?;

Required Methods§

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ExtractionRequest, ) -> Pin<Box<dyn Future<Output = Result<ExtractionResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute extraction using a request

Provided Methods§

Source

fn validate_selector<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _html: &'life1 str, _selector_expr: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(bool, usize)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Validate a selector against the current/provided DOM

Implementors§