pub struct CsvPipeline<I> { /* private fields */ }Expand description
CSV file output pipeline. A pipeline that exports scraped items to a CSV file. Headers are determined from the keys of the first item processed.
Implementations§
Source§impl<I> CsvPipeline<I>where
I: ScrapedItem,
impl<I> CsvPipeline<I>where
I: ScrapedItem,
Sourcepub fn new(file_path: impl AsRef<Path>) -> Result<CsvPipeline<I>, PipelineError>
pub fn new(file_path: impl AsRef<Path>) -> Result<CsvPipeline<I>, PipelineError>
Sourcepub fn with_schema_export_config(
self,
config: SchemaExportConfig,
) -> CsvPipeline<I>
pub fn with_schema_export_config( self, config: SchemaExportConfig, ) -> CsvPipeline<I>
Applies typed export mapping before values are written.
Trait Implementations§
Source§impl<I> Pipeline<I> for CsvPipeline<I>where
I: ScrapedItem,
impl<I> Pipeline<I> for CsvPipeline<I>where
I: ScrapedItem,
Source§fn process_item<'life0, 'async_trait>(
&'life0 self,
item: I,
) -> Pin<Box<dyn Future<Output = Result<Option<I>, PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
CsvPipeline<I>: 'async_trait,
fn process_item<'life0, 'async_trait>(
&'life0 self,
item: I,
) -> Pin<Box<dyn Future<Output = Result<Option<I>, PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
CsvPipeline<I>: 'async_trait,
Processes a single scraped item. Read more
Source§fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
CsvPipeline<I>: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
CsvPipeline<I>: 'async_trait,
Called when the spider is closing. Read more
Source§fn get_state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
CsvPipeline<I>: 'async_trait,
fn get_state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
CsvPipeline<I>: 'async_trait,
Returns the current state of the pipeline as a JSON value. Read more
Source§fn restore_state<'life0, 'async_trait>(
&'life0 self,
state: Value,
) -> Pin<Box<dyn Future<Output = Result<(), PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
CsvPipeline<I>: 'async_trait,
fn restore_state<'life0, 'async_trait>(
&'life0 self,
state: Value,
) -> Pin<Box<dyn Future<Output = Result<(), PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
CsvPipeline<I>: 'async_trait,
Restores the pipeline’s state from a JSON value. Read more
Auto Trait Implementations§
impl<I> Freeze for CsvPipeline<I>
impl<I> !RefUnwindSafe for CsvPipeline<I>
impl<I> Send for CsvPipeline<I>where
I: Send,
impl<I> Sync for CsvPipeline<I>where
I: Sync,
impl<I> Unpin for CsvPipeline<I>where
I: Unpin,
impl<I> !UnwindSafe for CsvPipeline<I>
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