Crate rustpostal[][src]

Expand description

libpostal bindings for the Rust programming language.

Examples

use rustpostal::address;
use rustpostal::expand;
use rustpostal::LibModules;

fn main() -> Result<(), rustpostal::error::RuntimeError> {
    let postal_module = LibModules::All;
    postal_module.setup()?;

    let address = "St Johns Centre, Rope Walk, Bedford, Bedfordshire, MK42 0XE, United Kingdom";

    let labeled_tokens = address::parse_address(address, None, None)?;

    for (token, label) in &labeled_tokens {
        println!("{}: {}", token, label);
    }

    let expanded = expand::expand_address_with_options(address, Some(["en"].iter()))?;

    for expansion in &expanded {
        println!("{}", expansion);
    }
    Ok(())
}

Modules

Parsing utilities for postal addresses.

Runtime errors for the rustpostal crate.

Normalization utilities.

Enums

Library modules to setup and teardown, at the start and at the end of our program.

Functions

setupDeprecated

Setup the necessary libpostal components.

teardownDeprecated

Teardown initialized libpostal components.