stac_client/lib.rs
1//! # STAC Client for Rust
2//!
3//! A friendly, async client for the [SpatioTemporal Asset Catalog (STAC)](https://stacspec.org/)
4//! specification, written in Rust.
5//!
6//! This library helps you interact with STAC APIs to find and retrieve geospatial data. It is
7//! built on `tokio` for async operations and `reqwest` for HTTP requests.
8//!
9//! ## Project Goals
10//!
11//! - **Idiomatic Rust API**: Provide an API that feels natural to Rust developers.
12//! - **Minimal Dependencies**: Keep the dependency tree small and manageable.
13//! - **Well-Documented**: Offer clear documentation for all public APIs.
14//! - **Thoroughly Tested**: Maintain high test coverage to ensure stability.
15//!
16//! ## Quick Start
17//!
18//! ```rust,no_run
19//! use stac_client::{Client, SearchBuilder};
20//! use std::error::Error;
21//!
22//! #[tokio::main]
23//! async fn main() -> Result<(), Box<dyn Error>> {
24//! let url = "https://planetarycomputer.microsoft.com/api/stac/v1";
25//! let client = Client::new(url)?;
26//!
27//! let search = SearchBuilder::new()
28//! .collections(vec!["sentinel-2-l2a".to_string()])
29//! .limit(10)
30//! .build();
31//!
32//! let results = client.search(&search).await?;
33//! println!("Found {} items.", results.features.len());
34//!
35//! Ok(())
36//! }
37//! ```
38//!
39//! ## Optional Features
40//!
41//! - `pagination`: Enables the `Client::search_next_page` method for easy pagination.
42
43#![deny(missing_docs)]
44#![deny(unused_must_use)]
45#![deny(rust_2018_idioms)]
46#![deny(unreachable_pub)]
47#![deny(clippy::all)]
48#![deny(clippy::pedantic)]
49#![allow(clippy::module_name_repetitions)]
50
51/// The core STAC API client and search builder.
52pub mod client;
53/// Error and result types.
54pub mod error;
55/// STAC data models, such as `Item`, `Collection`, and `Catalog`.
56pub mod models;
57
58pub use client::{Client, SearchBuilder};
59pub use error::{Error, Result};
60pub use models::*;