Struct postcode_nl::PostcodeClient
source · [−]pub struct PostcodeClient { /* private fields */ }Expand description
The client that calls the API.
Implementations
sourceimpl PostcodeClient
impl PostcodeClient
sourcepub fn new(api_token: &str) -> Self
pub fn new(api_token: &str) -> Self
Initialize a new client with an API token.
let client = PostcodeClient::new("YOUR_API_TOKEN");sourcepub async fn get_address(
&self,
postcode: &str,
house_number: u32
) -> Result<(Option<Address>, ApiLimits), PostcodeError>
pub async fn get_address(
&self,
postcode: &str,
house_number: u32
) -> Result<(Option<Address>, ApiLimits), PostcodeError>
Find the address matching the given postcode and house number. Postcodes are formatted 1234AB or 1234 AB (with a single space). House numbers must be integers and not include postfix characters. Returns None when the address could not be found.
let (address, limits) = client.get_address("1012RJ", 147).await?;sourcepub async fn get_extended_address(
&self,
postcode: &str,
house_number: u32
) -> Result<(Option<ExtendedAddress>, ApiLimits), PostcodeError>
pub async fn get_extended_address(
&self,
postcode: &str,
house_number: u32
) -> Result<(Option<ExtendedAddress>, ApiLimits), PostcodeError>
Find the address, municipality, province and coordinates matching the given postcode and house number. Postcodes are formatted 1234AB or 1234 AB (with a single space). House numbers must be integers and not include postfix characters. Returns None when the address could not be found.
let (address, limits) = client.get_extended_address("1012RJ", 147).await?;Auto Trait Implementations
impl !RefUnwindSafe for PostcodeClient
impl Send for PostcodeClient
impl Sync for PostcodeClient
impl Unpin for PostcodeClient
impl !UnwindSafe for PostcodeClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more