pub struct CrawlerContext<S, I>where
S: Spider<Item = I>,
I: ScrapedItem,{
pub scheduler: Arc<Scheduler>,
pub stats: Arc<StatCollector>,
pub spider: Arc<S>,
pub spider_state: Arc<S::State>,
pub pipelines: Arc<Vec<Box<dyn Pipeline<I>>>>,
}Expand description
Aggregated context shared across all crawler tasks.
This struct bundles together all the Arc-wrapped components that need to be shared between the crawler’s various async tasks. Instead of cloning each Arc individually, we can clone this context with a single Arc::clone().
Fields§
§scheduler: Arc<Scheduler>§stats: Arc<StatCollector>§spider: Arc<S>§spider_state: Arc<S::State>§pipelines: Arc<Vec<Box<dyn Pipeline<I>>>>Implementations§
Source§impl<S, I> CrawlerContext<S, I>where
S: Spider<Item = I>,
I: ScrapedItem,
impl<S, I> CrawlerContext<S, I>where
S: Spider<Item = I>,
I: ScrapedItem,
Trait Implementations§
Source§impl<S, I> Clone for CrawlerContext<S, I>where
S: Spider<Item = I>,
I: ScrapedItem,
impl<S, I> Clone for CrawlerContext<S, I>where
S: Spider<Item = I>,
I: ScrapedItem,
Auto Trait Implementations§
impl<S, I> Freeze for CrawlerContext<S, I>
impl<S, I> !RefUnwindSafe for CrawlerContext<S, I>
impl<S, I> Send for CrawlerContext<S, I>
impl<S, I> Sync for CrawlerContext<S, I>
impl<S, I> Unpin for CrawlerContext<S, I>
impl<S, I> UnsafeUnpin for CrawlerContext<S, I>
impl<S, I> !UnwindSafe for CrawlerContext<S, 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