pub struct PostcodeClient { /* private fields */ }Expand description
The client that calls the API.
Implementations§
Source§impl 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 Freeze for PostcodeClient
impl !RefUnwindSafe for PostcodeClient
impl Send for PostcodeClient
impl Sync for PostcodeClient
impl Unpin for PostcodeClient
impl !UnwindSafe for PostcodeClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more