naija_geo/lib.rs
1//! # naija-geo
2//!
3//! Nigerian geopolitical zones, states and local government areas (LGAs).
4//!
5//! Covers all **6 zones**, **37 states** (36 states + FCT) and all **774 LGAs**
6//! with full bi-directional navigation helpers.
7//!
8//! ## Quick start
9//!
10//! ```rust
11//! use naija_geo::{Zone, State, Lga};
12//!
13//! // All zones
14//! for z in Zone::all() {
15//! println!("{} — {} states", z.name, z.state_count());
16//! }
17//!
18//! // Lookup by code (case-insensitive)
19//! let lagos = State::find("LA").unwrap();
20//! assert_eq!(lagos.capital, "Ikeja");
21//! assert_eq!(lagos.lga_count(), 20);
22//!
23//! // Navigate upward from an LGA
24//! let lga = Lga::find("LA020").unwrap(); // Surulere
25//! let state = lga.state().unwrap(); // Lagos
26//! let zone = lga.zone().unwrap(); // South West
27//! println!("{} → {} → {}", lga.name, state.name, zone.name);
28//!
29//! // Navigate downward from a zone
30//! let sw_lgas = Zone::find("SW").unwrap().lgas();
31//! println!("South West has {} LGAs", sw_lgas.len());
32//! ```
33//!
34//! ## Feature flags
35//!
36//! | Feature | What it adds |
37//! |---------|-------------|
38//! | `serde` | `Serialize` / `Deserialize` on all public structs |
39//! | `fuzzy` | `find_fuzzy(name)` on `Zone`, `State`, `Lga` |
40
41pub mod error;
42pub mod lga;
43pub mod state;
44pub mod zone;
45
46mod data;
47
48// Re-export the three primary types at the crate root for ergonomics.
49pub use error::NaijaGeoError;
50pub use lga::Lga;
51pub use state::State;
52pub use zone::Zone;