pub struct JsonlPipeline<I>where
I: ScrapedItem,{ /* private fields */ }Expand description
JSON Lines output pipeline. A pipeline that writes each scraped item to a JSON Lines (.jsonl) file. Each item is written as a JSON object on a new line.
Implementations§
Source§impl<I> JsonlPipeline<I>where
I: ScrapedItem,
impl<I> JsonlPipeline<I>where
I: ScrapedItem,
Sourcepub fn new(
file_path: impl AsRef<Path>,
) -> Result<JsonlPipeline<I>, PipelineError>
pub fn new( file_path: impl AsRef<Path>, ) -> Result<JsonlPipeline<I>, PipelineError>
Creates a new JsonlPipeline that writes to the specified file path.
§Errors
Returns an error when the output file cannot be opened or the parent directory cannot be created.
Sourcepub fn with_schema_export_config(
self,
config: SchemaExportConfig,
) -> JsonlPipeline<I>
pub fn with_schema_export_config( self, config: SchemaExportConfig, ) -> JsonlPipeline<I>
Applies typed export mapping before values are written.
Trait Implementations§
Source§impl<I> Pipeline<I> for JsonlPipeline<I>where
I: ScrapedItem,
impl<I> Pipeline<I> for JsonlPipeline<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,
JsonlPipeline<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,
JsonlPipeline<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,
JsonlPipeline<I>: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
JsonlPipeline<I>: 'async_trait,
Called when the spider is closing. Read more
Auto Trait Implementations§
impl<I> Freeze for JsonlPipeline<I>
impl<I> RefUnwindSafe for JsonlPipeline<I>where
I: RefUnwindSafe,
impl<I> Send for JsonlPipeline<I>
impl<I> Sync for JsonlPipeline<I>
impl<I> Unpin for JsonlPipeline<I>where
I: Unpin,
impl<I> UnwindSafe for JsonlPipeline<I>where
I: UnwindSafe,
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