Expand description
Rust client for the OpenCellID public API.
§Features
async(default): asynchronousClientbacked byreqwest::Client. Brings intokioas a dependency.blocking: synchronousBlockingClientbacked byreqwest::blocking::Client.csv(default): enablescell/getInArea(CSV-formatted bulk listing).rustls-tls(default) /native-tls: select the TLS backend. If both are enabled,reqwest’s default applies — prefer choosing exactly one explicitly.
Both clients can be enabled simultaneously and share a single ClientBuilder.
§Logging
Every public call is wrapped in a tracing span. The API key is redacted from
any URL emitted at debug level, and response bodies are length-bounded and
escaped before being included in error messages or trace events. Enable e.g.
tracing_subscriber::fmt().init() in application code to see the events.
§Quick start (async)
use opencellid::{CellKey, ClientBuilder, Radio};
let key = std::env::var("OPENCELLID_API_KEY")
.map_err(|_| opencellid::Error::MissingConfig("OPENCELLID_API_KEY"))?;
let client = ClientBuilder::new().api_key(key).build()?;
let cell = client
.get_cell(CellKey::new(250, 99, 7800, 200).with_radio(Radio::Lte))
.await?;
println!("{:?}", (cell.lat, cell.lon));Re-exports§
pub use error::ApiErrorCode;pub use error::Error;pub use error::ParseError;pub use error::Result;pub use error::TransportError;pub use error::UrlError;pub use params::AreaQuery;pub use params::GetCellsInAreaParams;pub use types::Bbox;pub use types::Cell;pub use types::CellCount;pub use types::CellKey;pub use types::DumpKind;pub use types::DumpListing;pub use types::Measurement;pub use types::MeasurementsPayload;pub use types::Radio;pub use types::DumpRow;csv
Modules§
- error
- Error types for the OpenCellID client.
- params
- Strongly-typed query parameters for endpoints.
- types
- Domain types: cells, bounding boxes, radio technologies, measurements.
Structs§
- Blocking
Client blocking - Synchronous OpenCellID client.
- Client
async - Asynchronous OpenCellID client.
- Client
Builder - Builder for the OpenCellID clients.
Functions§
- parse_
dump_ csv csv - Iterator over rows of a downloaded (already-decompressed) dump CSV.