Docs/SDKs

Rust SDK

Use the native job engine directly, with explicit session ownership and asynchronous execution.

Download .md
Developers2 min read4 sections
Source reference · Match your SDK version. Availability and known issues
In this guide

Dependencies

Use a path to the current checkout for DatasetJob. The same package version on a registry may represent an earlier alpha build.

[dependencies]
crawlingo = { path = "../crawlingo" }
tokio = { version = "1", features = ["full"] }
serde_json = "1"
toml4 lines · copy-ready

Generate a dataset

DatasetJob::new validates configuration. run().await performs the job. Clone the job handle when another task needs to call cancel(); each output directory permits only one active writer.

use crawlingo::dataset::{DatasetJob, JobConfig};
use crawlingo::engine::session::Session;
use std::sync::Arc;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config: JobConfig = serde_json::from_reader(
        std::fs::File::open("job.json")?
    )?;
    let job = DatasetJob::new(config, Arc::new(Session::new()))?;
    let report = job.run().await?;
    println!("{report:?}");
    Ok(())
}
rust14 lines · copy-ready

Bounded record streaming

DatasetStream is the lower-level record stream. Create a producer handle, detach the stream’s own sender, and await handle.send(record) from the producer while a consumer drains the stream. Synchronous push returns a capacity error when the queue is full.

write_csv and write_parquet consume the stream. Export errors propagate to the caller. Keep channel capacity and record size bounded; do not enqueue every record before starting the consumer.

Cargo features

FeaturePurpose
defaultCore engine; no Python extension or browser dependency.
cliRust command-line application.
pythonPyO3 extension for the Python SDK.
browserChromium rendering via the browser manager.