pub trait ScrapedItem:
Debug
+ Send
+ Sync
+ Any
+ 'static {
// Required methods
fn as_any(&self) -> &(dyn Any + 'static);
fn box_clone(&self) -> Box<dyn ScrapedItem + Sync + Send>;
fn to_json_value(&self) -> Value;
// Provided methods
fn item_schema(&self) -> Option<ItemSchema> { ... }
fn item_schema_version(&self) -> u32 { ... }
}Expand description
Parse-time output sink and item contracts used by Spider::parse.
Trait implemented by item types emitted from spiders.
In normal application code you usually do not implement this trait by hand.
Prefer annotating the item struct with #[scraped_item], which wires up the
required serialization and cloning behavior automatically.
Required Methods§
Sourcefn box_clone(&self) -> Box<dyn ScrapedItem + Sync + Send>
fn box_clone(&self) -> Box<dyn ScrapedItem + Sync + Send>
Clones the item into a Box<dyn ScrapedItem>.
Sourcefn to_json_value(&self) -> Value
fn to_json_value(&self) -> Value
Converts the item to a serde_json::Value.
Provided Methods§
Sourcefn item_schema(&self) -> Option<ItemSchema>
fn item_schema(&self) -> Option<ItemSchema>
Returns typed schema metadata when the item type exposes it.
Sourcefn item_schema_version(&self) -> u32
fn item_schema_version(&self) -> u32
Returns the schema version used by this item.