pub struct ParseOutput<I> { /* private fields */ }Expand description
Item contracts and parse results returned by Spider::parse.
The output returned by a spider’s parse method.
Implementations§
Source§impl<I> ParseOutput<I>
impl<I> ParseOutput<I>
Sourcepub fn new() -> ParseOutput<I>
pub fn new() -> ParseOutput<I>
Creates a new, empty ParseOutput.
Most spiders start each parse call with this and then append items and follow-up requests as they discover them.
Sourcepub fn into_parts(self) -> (Vec<I>, Vec<Request>)
pub fn into_parts(self) -> (Vec<I>, Vec<Request>)
Consumes the ParseOutput and returns its inner items and requests.
This is mainly used by the runtime, but can also be handy in isolated parsing helpers.
Sourcepub fn add_item(&mut self, item: I)
pub fn add_item(&mut self, item: I)
Adds a scraped item to the output.
Use this when the current page produced one structured result that should continue through the configured pipeline chain.
Sourcepub fn add_request(&mut self, request: Request)
pub fn add_request(&mut self, request: Request)
Adds a new request to be crawled.
Requests emitted here are handed back to the scheduler after the parse step completes.
Sourcepub fn add_items(&mut self, items: impl IntoIterator<Item = I>)
pub fn add_items(&mut self, items: impl IntoIterator<Item = I>)
Adds multiple scraped items to the output.
Sourcepub fn add_requests(&mut self, requests: impl IntoIterator<Item = Request>)
pub fn add_requests(&mut self, requests: impl IntoIterator<Item = Request>)
Adds multiple new requests to be crawled.
Trait Implementations§
Source§impl<I> Clone for ParseOutput<I>where
I: Clone,
impl<I> Clone for ParseOutput<I>where
I: Clone,
Source§fn clone(&self) -> ParseOutput<I>
fn clone(&self) -> ParseOutput<I>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more