kumo 0.2.4

An async web crawling framework for Rust — Scrapy for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::ItemStore;
use crate::error::KumoError;

/// Prints each item as a JSON line to stdout. Useful for piping output.
#[derive(Debug)]
pub struct StdoutStore;

#[async_trait::async_trait]
impl ItemStore for StdoutStore {
    async fn store(&self, item: &serde_json::Value) -> Result<(), KumoError> {
        let json =
            serde_json::to_string(item).map_err(|e| KumoError::store("stdout serialization", e))?;
        println!("{json}");
        Ok(())
    }
}