Expand description
Nigeria’s National Digital Alphanumeric Postcode (NDAPS), the building-level postcode issued by NIPOST.
The crate has a pure core and an optional shell:
Postcodeparses, validates and formats codes offline.api(featureapi) describes the NIPOST API as plain data: requests to send and responses to decode, with no I/O.client(featureclient) is a small blocking HTTP client overapi.
use ng_postcode::{Postcode, Segment};
let code: Postcode = "ek 01 a03 fk 01".parse()?;
assert_eq!(code.to_string(), "EK-01-A03-FK-01");
assert_eq!(code.as_str(), "EK01A03FK01");
assert_eq!(code.state(), "EK");
assert_eq!(code.prefix(Segment::Area), "EK-01-A03-FK");Modules§
- api
- The NIPOST Postcode API as plain data: requests to send and responses to decode. Nothing here performs I/O, so it works with any HTTP client.
- client
- A blocking HTTP client: the only part of the crate that performs I/O.
Structs§
- Corrected
- The result of
Postcode::parse_lenient. - Postcode
- A well-formed postcode, held in its compact upper-case form.
Enums§
- Parse
Error - Why a string is not a well-formed postcode.
- Segment
- The five segments of a postcode,
AA-99-H77-BB-55, from widest to narrowest.
Functions§
- is_
valid - Whether
inputis a well-formed postcode.