pub struct StreamJsonPipeline<I>where
I: ScrapedItem,{ /* private fields */ }Expand description
Streaming JSON output pipeline. A pipeline that streams items directly to a JSON file without accumulating them in memory.
Implementations§
Source§impl<I> StreamJsonPipeline<I>where
I: ScrapedItem,
impl<I> StreamJsonPipeline<I>where
I: ScrapedItem,
Sourcepub fn new(
file_path: impl AsRef<Path>,
) -> Result<StreamJsonPipeline<I>, PipelineError>
pub fn new( file_path: impl AsRef<Path>, ) -> Result<StreamJsonPipeline<I>, PipelineError>
Creates a new StreamJsonPipeline with default batch size.
§Errors
Returns an error when the output directory cannot be created.
Sourcepub fn with_batch_size(
file_path: impl AsRef<Path>,
batch_size: usize,
) -> Result<StreamJsonPipeline<I>, PipelineError>
pub fn with_batch_size( file_path: impl AsRef<Path>, batch_size: usize, ) -> Result<StreamJsonPipeline<I>, PipelineError>
Creates a new StreamJsonPipeline with a specified batch size.
§Errors
Returns an error when the output directory cannot be created.
Sourcepub fn with_schema_export_config(
self,
config: SchemaExportConfig,
) -> StreamJsonPipeline<I>
pub fn with_schema_export_config( self, config: SchemaExportConfig, ) -> StreamJsonPipeline<I>
Applies typed export mapping before values are written.
Trait Implementations§
Source§impl<I> Pipeline<I> for StreamJsonPipeline<I>where
I: ScrapedItem,
impl<I> Pipeline<I> for StreamJsonPipeline<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,
StreamJsonPipeline<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,
StreamJsonPipeline<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,
StreamJsonPipeline<I>: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PipelineError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamJsonPipeline<I>: 'async_trait,
Called when the spider is closing. Read more
Auto Trait Implementations§
impl<I> Freeze for StreamJsonPipeline<I>
impl<I> !RefUnwindSafe for StreamJsonPipeline<I>
impl<I> Send for StreamJsonPipeline<I>
impl<I> Sync for StreamJsonPipeline<I>
impl<I> Unpin for StreamJsonPipeline<I>where
I: Unpin,
impl<I> !UnwindSafe for StreamJsonPipeline<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