pub struct Engine<S: Spider> { /* private fields */ }Implementations§
Source§impl<S> Engine<S>
impl<S> Engine<S>
Sourcepub async fn start_crawl(self) -> Result<(), SpiderError>
pub async fn start_crawl(self) -> Result<(), SpiderError>
Examples found in repository?
examples/quotes.rs (line 117)
104async fn main() -> Result<(), anyhow::Error> {
105 let filter = EnvFilter::new("info,spider_lib=debug");
106 fmt().with_env_filter(filter).init();
107
108 info!("Starting RustScraper example...");
109
110 let engine = EngineBuilder::new(MySpider)
111 .add_pipeline(Box::new(JsonlWriterPipeline::<QuoteItem>::new(
112 "result.jsonl",
113 )?))
114 .build()
115 .await?;
116
117 engine.start_crawl().await?;
118
119 info!("RustScraper example finished.");
120
121 Ok(())
122}More examples
examples/books.rs (line 131)
119async fn main() -> Result<(), anyhow::Error> {
120 let filter = EnvFilter::new("info,spider_lib=debug");
121 fmt().with_env_filter(filter).init();
122
123 info!("Starting RustScraper example...");
124
125 let engine = EngineBuilder::new(BooksSpider)
126 .add_pipeline(Box::new(CsvExporterPipeline::new("books.csv")))
127 .max_concurrent_downloads(10)
128 .build()
129 .await?;
130
131 engine.start_crawl().await?;
132
133 info!("RustScraper example finished.");
134
135 Ok(())
136}Auto Trait Implementations§
impl<S> Freeze for Engine<S>
impl<S> !RefUnwindSafe for Engine<S>
impl<S> Send for Engine<S>
impl<S> Sync for Engine<S>
impl<S> Unpin for Engine<S>
impl<S> !UnwindSafe for Engine<S>
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