Struct rustpostal::address::AddressParserOptions [−][src]
pub struct AddressParserOptions { /* fields omitted */ }
Expand description
Parsing options.
Implementations
Create options for the address parser.
Examples
use rustpostal::address; fn main() -> Result<(), std::ffi::NulError> { let options = address::AddressParserOptions::new(Some("en"), Some("en"))?; Ok(()) }
Parse a postal address and derive labeled tokens using libpostal
.
Examples
use rustpostal::error::RuntimeError; use rustpostal::{address, LibModules}; fn main() -> Result<(), RuntimeError> { let postal_module = LibModules::Address; postal_module.setup()?; let options = address::AddressParserOptions::new(None, None)?; let address = "St Johns Centre, Rope Walk, Bedford, Bedfordshire, MK42 0XE, United Kingdom"; let labels_tokens = options.parse(address)?; for (label, token) in &labels_tokens { println!("{}: {}", label, token); } Ok(()) }
Errors
It will return an error if the address contains an internal null byte.
Trait Implementations
Returns the “default value” for a type. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for AddressParserOptions
impl Send for AddressParserOptions
impl Sync for AddressParserOptions
impl Unpin for AddressParserOptions
impl UnwindSafe for AddressParserOptions
Blanket Implementations
Mutably borrows from an owned value. Read more