Skip to main content

AddressComponent

Struct AddressComponent 

Source
pub struct AddressComponent {
    pub component_name: ComponentName,
    pub component_type: String,
    pub confirmation_level: ConfirmationLevel,
    pub inferred: bool,
    pub spell_corrected: bool,
    pub replaced: bool,
    pub unexpected: bool,
}
Expand description

Represents an address component, such as a street, city, or state.

The addressComponent property is a subcomponent of address which provides a detailed listing of the elements—or components—of the address that the Address Validation API has processed. The API identifies each component field provides by its name, type, and confirmation level.

§Key Point

  • Use the address property to obtain address formatting. Use its subcomponent addressComponent for investigating errors and providing information about those errors to your customers. However, don’t build your integration to rely on the specific confirmation level for address components. See Build your validation logic for integration guidance.

Fields§

§component_name: ComponentName

The name for this component.

§component_type: String

The type of the address component. See Table 2: Additional types returned by the Places service for a list of possible types.

§confirmation_level: ConfirmationLevel

Indicates the level of certainty that we have that the component is correct.

§inferred: bool

Indicates that the component was not part of the input, but we inferred it for the address location and believe it should be provided for a complete address.

§spell_corrected: bool

Indicates a correction to a misspelling in the component name. The API does not always flag changes from one spelling variant to another, such as when changing “centre” to “center”. It also does not always flag common misspellings, such as when changing “Amphitheater Pkwy” to “Amphitheatre Pkwy”.

§replaced: bool

Indicates the name of the component was replaced with a completely different one, for example a wrong postal code being replaced with one that is correct for the address. This is not a cosmetic change, the input component has been changed to a different one.

§unexpected: bool

Indicates an address component that is not expected to be present in a postal address for the given region. We have retained it only because it was part of the input.

Implementations§

Source§

impl AddressComponent

Source

pub fn inferred(&self) -> bool

Indicates that the component was not part of the input, but we inferred it for the address location and believe it should be provided for a complete address.

Source

pub fn spell_corrected(&self) -> bool

Indicates a correction to a misspelling in the component name. The API does not always flag changes from one spelling variant to another, such as when changing “centre” to “center”. It also does not always flag common misspellings, such as when changing “Amphitheater Pkwy” to “Amphitheatre Pkwy”.

Source

pub fn replaced(&self) -> bool

Indicates the name of the component was replaced with a completely different one, for example a wrong postal code being replaced with one that is correct for the address. This is not a cosmetic change, the input component has been changed to a different one.

Source

pub fn unexpected(&self) -> bool

Indicates an address component that is not expected to be present in a postal address for the given region. We have retained it only because it was part of the input.

Source§

impl AddressComponent

Source

pub fn component_name(&self) -> &ComponentName

The name for this component.

Source

pub fn component_type(&self) -> &String

The type of the address component. See Table 2: Additional types returned by the Places service for a list of possible types.

Source

pub fn confirmation_level(&self) -> &ConfirmationLevel

Indicates the level of certainty that we have that the component is correct.

Source§

impl AddressComponent

Source

pub fn component_name_mut(&mut self) -> &mut ComponentName

The name for this component.

Source

pub fn component_type_mut(&mut self) -> &mut String

The type of the address component. See Table 2: Additional types returned by the Places service for a list of possible types.

Source

pub fn confirmation_level_mut(&mut self) -> &mut ConfirmationLevel

Indicates the level of certainty that we have that the component is correct.

Source

pub fn inferred_mut(&mut self) -> &mut bool

Indicates that the component was not part of the input, but we inferred it for the address location and believe it should be provided for a complete address.

Source

pub fn spell_corrected_mut(&mut self) -> &mut bool

Indicates a correction to a misspelling in the component name. The API does not always flag changes from one spelling variant to another, such as when changing “centre” to “center”. It also does not always flag common misspellings, such as when changing “Amphitheater Pkwy” to “Amphitheatre Pkwy”.

Source

pub fn replaced_mut(&mut self) -> &mut bool

Indicates the name of the component was replaced with a completely different one, for example a wrong postal code being replaced with one that is correct for the address. This is not a cosmetic change, the input component has been changed to a different one.

Source

pub fn unexpected_mut(&mut self) -> &mut bool

Indicates an address component that is not expected to be present in a postal address for the given region. We have retained it only because it was part of the input.

Source§

impl AddressComponent

Source

pub fn set_component_name(&mut self, val: ComponentName) -> &mut Self

The name for this component.

Source

pub fn set_component_type(&mut self, val: String) -> &mut Self

The type of the address component. See Table 2: Additional types returned by the Places service for a list of possible types.

Source

pub fn set_confirmation_level(&mut self, val: ConfirmationLevel) -> &mut Self

Indicates the level of certainty that we have that the component is correct.

Source

pub fn set_inferred(&mut self, val: bool) -> &mut Self

Indicates that the component was not part of the input, but we inferred it for the address location and believe it should be provided for a complete address.

Source

pub fn set_spell_corrected(&mut self, val: bool) -> &mut Self

Indicates a correction to a misspelling in the component name. The API does not always flag changes from one spelling variant to another, such as when changing “centre” to “center”. It also does not always flag common misspellings, such as when changing “Amphitheater Pkwy” to “Amphitheatre Pkwy”.

Source

pub fn set_replaced(&mut self, val: bool) -> &mut Self

Indicates the name of the component was replaced with a completely different one, for example a wrong postal code being replaced with one that is correct for the address. This is not a cosmetic change, the input component has been changed to a different one.

Source

pub fn set_unexpected(&mut self, val: bool) -> &mut Self

Indicates an address component that is not expected to be present in a postal address for the given region. We have retained it only because it was part of the input.

Trait Implementations§

Source§

impl Clone for AddressComponent

Source§

fn clone(&self) -> AddressComponent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AddressComponent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AddressComponent

Source§

fn default() -> AddressComponent

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for AddressComponent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for AddressComponent

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for AddressComponent

Source§

fn cmp(&self, other: &AddressComponent) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for AddressComponent

Source§

fn eq(&self, other: &AddressComponent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for AddressComponent

Source§

fn partial_cmp(&self, other: &AddressComponent) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for AddressComponent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AddressComponent

Source§

impl StructuralPartialEq for AddressComponent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,