[][src]Struct usps_api::USPSWebTool

pub struct USPSWebTool { /* fields omitted */ }

This struct is how you will make API calls to the USPS. It can be initialized with a hardcoded user_id and password using the 'init' contructor or it can attempt to capture these values from the environment (USPS_USER_ID and USPS_PASSWORD respectively) using the 'new' constructor.

Methods

impl USPSWebTool[src]

pub fn init(user_id: &str, password: &str) -> Self[src]

Used to build a new USPSWebTool struct by specifying the USPS authentication credentials directly."

Example

let usps_api = USPSWebTool::init("XXXX", "YYYY");

pub fn new() -> Result<Self, VarError>[src]

Used to build a new USPSWebTool struct by looking at the environment variables "USPS_USER_ID" and "USPS_PASSWORD to specify the USPS authentication credentials."

Example

env::set_var("USPS_USER_ID", "XXXX");
env::set_var("USPS_PASSWORD", "YYYY");
let usps_api = USPSWebTool::new()?;

pub fn use_http(self) -> Self[src]

Will use the unsecured endpoint for communication with the USPS API. This feature is not recommended.

Example

let usps_api = USPSWebTool::init("XXXX", "YYYY").use_http();

pub fn verify_address(
    &self,
    address: USPSAddress
) -> Result<USPSAddress, Box<dyn Error>>
[src]

Accepts a USPS Address and returns a result with the 'correct' form of the address.

Trait Implementations

impl PartialEq<USPSWebTool> for USPSWebTool[src]

impl Debug for USPSWebTool[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err