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
addressproperty to obtain address formatting. Use its subcomponentaddressComponentfor 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: ComponentNameThe name for this component.
component_type: StringThe type of the address component. See Table 2: Additional types returned by the Places service for a list of possible types.
confirmation_level: ConfirmationLevelIndicates the level of certainty that we have that the component is correct.
inferred: boolIndicates 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: boolIndicates 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: boolIndicates 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: boolIndicates 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
impl AddressComponent
Sourcepub fn inferred(&self) -> bool
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.
Sourcepub fn spell_corrected(&self) -> bool
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”.
Sourcepub fn replaced(&self) -> bool
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.
Sourcepub fn unexpected(&self) -> bool
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
impl AddressComponent
Sourcepub fn component_name(&self) -> &ComponentName
pub fn component_name(&self) -> &ComponentName
The name for this component.
Sourcepub fn component_type(&self) -> &String
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.
Sourcepub fn confirmation_level(&self) -> &ConfirmationLevel
pub fn confirmation_level(&self) -> &ConfirmationLevel
Indicates the level of certainty that we have that the component is correct.
Source§impl AddressComponent
impl AddressComponent
Sourcepub fn component_name_mut(&mut self) -> &mut ComponentName
pub fn component_name_mut(&mut self) -> &mut ComponentName
The name for this component.
Sourcepub fn component_type_mut(&mut self) -> &mut String
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.
Sourcepub fn confirmation_level_mut(&mut self) -> &mut ConfirmationLevel
pub fn confirmation_level_mut(&mut self) -> &mut ConfirmationLevel
Indicates the level of certainty that we have that the component is correct.
Sourcepub fn inferred_mut(&mut self) -> &mut bool
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.
Sourcepub fn spell_corrected_mut(&mut self) -> &mut bool
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”.
Sourcepub fn replaced_mut(&mut self) -> &mut bool
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.
Sourcepub fn unexpected_mut(&mut self) -> &mut bool
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
impl AddressComponent
Sourcepub fn set_component_name(&mut self, val: ComponentName) -> &mut Self
pub fn set_component_name(&mut self, val: ComponentName) -> &mut Self
The name for this component.
Sourcepub fn set_component_type(&mut self, val: String) -> &mut Self
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.
Sourcepub fn set_confirmation_level(&mut self, val: ConfirmationLevel) -> &mut Self
pub fn set_confirmation_level(&mut self, val: ConfirmationLevel) -> &mut Self
Indicates the level of certainty that we have that the component is correct.
Sourcepub fn set_inferred(&mut self, val: bool) -> &mut Self
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.
Sourcepub fn set_spell_corrected(&mut self, val: bool) -> &mut Self
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”.
Sourcepub fn set_replaced(&mut self, val: bool) -> &mut Self
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.
Sourcepub fn set_unexpected(&mut self, val: bool) -> &mut Self
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
impl Clone for AddressComponent
Source§fn clone(&self) -> AddressComponent
fn clone(&self) -> AddressComponent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AddressComponent
impl Debug for AddressComponent
Source§impl Default for AddressComponent
impl Default for AddressComponent
Source§fn default() -> AddressComponent
fn default() -> AddressComponent
Source§impl<'de> Deserialize<'de> for AddressComponent
impl<'de> Deserialize<'de> for AddressComponent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for AddressComponent
impl Hash for AddressComponent
Source§impl Ord for AddressComponent
impl Ord for AddressComponent
Source§fn cmp(&self, other: &AddressComponent) -> Ordering
fn cmp(&self, other: &AddressComponent) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for AddressComponent
impl PartialEq for AddressComponent
Source§impl PartialOrd for AddressComponent
impl PartialOrd for AddressComponent
Source§impl Serialize for AddressComponent
impl Serialize for AddressComponent
impl Eq for AddressComponent
impl StructuralPartialEq for AddressComponent
Auto Trait Implementations§
impl Freeze for AddressComponent
impl RefUnwindSafe for AddressComponent
impl Send for AddressComponent
impl Sync for AddressComponent
impl Unpin for AddressComponent
impl UnwindSafe for AddressComponent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.