pub struct ExtractionTemplate {
pub id: Uuid,
pub name: String,
pub description: Option<String>,
pub regions: Vec<Region>,
pub metadata: TemplateMetadata,
}Expand description
A reusable extraction template defining how to extract data from a page
Templates combine multiple regions, each with selectors and transformations. A template is the core unit of plugin configuration and is persisted for reuse.
§Example
use stygian_plugin::domain::{ExtractionTemplate, Region, Selector};
use serde_json::json;
let template = ExtractionTemplate {
id: uuid::Uuid::new_v4(),
name: "Product Listing".to_string(),
description: Some("Extract product cards from a listing page".to_string()),
regions: vec![],
metadata: Default::default(),
};Fields§
§id: UuidUnique identifier for this template
name: StringUser-friendly template name
description: Option<String>Optional description
regions: Vec<Region>Regions (named extraction zones) in this template
metadata: TemplateMetadataMetadata (timestamps, version, etc.)
Implementations§
Source§impl ExtractionTemplate
impl ExtractionTemplate
Sourcepub fn with_region(self, region: Region) -> Self
pub fn with_region(self, region: Region) -> Self
Add a region to this template
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Set template description
Set template tags
Trait Implementations§
Source§impl Clone for ExtractionTemplate
impl Clone for ExtractionTemplate
Source§fn clone(&self) -> ExtractionTemplate
fn clone(&self) -> ExtractionTemplate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExtractionTemplate
impl Debug for ExtractionTemplate
Source§impl<'de> Deserialize<'de> for ExtractionTemplate
impl<'de> Deserialize<'de> for ExtractionTemplate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ExtractionTemplate
impl RefUnwindSafe for ExtractionTemplate
impl Send for ExtractionTemplate
impl Sync for ExtractionTemplate
impl Unpin for ExtractionTemplate
impl UnsafeUnpin for ExtractionTemplate
impl UnwindSafe for ExtractionTemplate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more