pub struct PhoneMetadata {Show 31 fields
pub general_desc: Option<PhoneNumberDesc>,
pub fixed_line: Option<PhoneNumberDesc>,
pub mobile: Option<PhoneNumberDesc>,
pub toll_free: Option<PhoneNumberDesc>,
pub premium_rate: Option<PhoneNumberDesc>,
pub shared_cost: Option<PhoneNumberDesc>,
pub personal_number: Option<PhoneNumberDesc>,
pub voip: Option<PhoneNumberDesc>,
pub pager: Option<PhoneNumberDesc>,
pub uan: Option<PhoneNumberDesc>,
pub emergency: Option<PhoneNumberDesc>,
pub voicemail: Option<PhoneNumberDesc>,
pub short_code: Option<PhoneNumberDesc>,
pub standard_rate: Option<PhoneNumberDesc>,
pub carrier_specific: Option<PhoneNumberDesc>,
pub sms_services: Option<PhoneNumberDesc>,
pub no_international_dialling: Option<PhoneNumberDesc>,
pub id: String,
pub country_code: Option<i32>,
pub international_prefix: Option<String>,
pub preferred_international_prefix: Option<String>,
pub national_prefix: Option<String>,
pub preferred_extn_prefix: Option<String>,
pub national_prefix_for_parsing: Option<String>,
pub national_prefix_transform_rule: Option<String>,
pub same_mobile_and_fixed_line_pattern: Option<bool>,
pub number_format: Vec<NumberFormat>,
pub intl_number_format: Vec<NumberFormat>,
pub main_country_for_code: Option<bool>,
pub leading_digits: Option<String>,
pub mobile_number_portable_region: Option<bool>,
}Expand description
If you add, remove, or rename fields, or change their semantics, check if you should change the excludable field sets or the behavior in MetadataFilter.
Fields§
§general_desc: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
The general_desc contains information which is a superset of descriptions for all types of phone numbers. If any element is missing in the description of a specific type in the XML file, the element will inherit from its counterpart in the general_desc. For all types that are generally relevant to normal phone numbers, if the whole type is missing in the PhoneNumberMetadata XML file, it will not have national number data, and the possible lengths will be [-1].
fixed_line: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
mobile: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
toll_free: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
personal_number: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
voip: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
pager: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
uan: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
emergency: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
voicemail: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
short_code: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
standard_rate: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
carrier_specific: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
sms_services: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
no_international_dialling: Option<PhoneNumberDesc>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
The rules here distinguish the numbers that are only able to be dialled nationally.
id: StringThe CLDR 2-letter representation of a country/region, with the exception of “country calling codes” used for non-geographical entities, such as Universal International Toll Free Number (+800). These are all given the ID “001”, since this is the numeric region code for the world according to UN M.49: http://en.wikipedia.org/wiki/UN_M.49
country_code: Option<i32>The country calling code that one would dial from overseas when trying to dial a phone number in this country. For example, this would be “64” for New Zealand.
international_prefix: Option<String>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
The international_prefix of country A is the number that needs to be dialled from country A to another country (country B). This is followed by the country code for country B. Note that some countries may have more than one international prefix, and for those cases, a regular expression matching the international prefixes will be stored in this field.
preferred_international_prefix: Option<String>If the international prefix that we want to use when formatting the number for out-of-country dialling contains non-digit symbols, or there is more than one international prefix is present, a preferred prefix can be specified here for out-of-country formatting purposes. If this field is not present, and multiple international prefixes are present, then “+” will be used instead.
national_prefix: Option<String>The national prefix of country A is the number that needs to be dialled before the national significant number when dialling internally. This would not be dialled when dialling internationally. For example, in New Zealand, the number that would be locally dialled as 09 345 3456 would be dialled from overseas as +64 9 345 3456. In this case, 0 is the national prefix.
preferred_extn_prefix: Option<String>The preferred prefix when specifying an extension in this country. This is used for formatting only, and if this is not specified, a suitable default should be used instead. For example, if you wanted extensions to be formatted in the following way: 1 (365) 345 445 ext. 2345 “ ext. “ should be the preferred extension prefix.
national_prefix_for_parsing: Option<String>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
This field is used for cases where the national prefix of a country contains a carrier selection code, and is written in the form of a regular expression. For example, to dial the number 2222-2222 in Fortaleza, Brazil (area code 85) using the long distance carrier Oi (selection code 31), one would dial 0 31 85 2222 2222. Assuming the only other possible carrier selection code is 32, the field will contain “03[12]”.
When it is missing from the XML file, this field inherits the value of national_prefix, if that is present.
national_prefix_transform_rule: Option<String>This field is only populated and used under very rare situations. For example, mobile numbers in Argentina are written in two completely different ways when dialed in-country and out-of-country (e.g. 0343 15 555 1212 is exactly the same number as +54 9 343 555 1212). This field is used together with national_prefix_for_parsing to transform the number into a particular representation for storing in the phonenumber proto buffer in those rare cases.
same_mobile_and_fixed_line_pattern: Option<bool>Specifies whether the mobile and fixed-line patterns are the same or not. This is used to speed up determining phone number type in countries where these two types of phone numbers can never be distinguished.
number_format: Vec<NumberFormat>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
Note that the number format here is used for formatting only, not parsing. Hence all the varied ways a user may write a number need not be recorded
- just the ideal way we would like to format it for them. When this element is absent, the national significant number will be formatted as a whole without any formatting applied.
intl_number_format: Vec<NumberFormat>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
This field is populated only when the national significant number is
formatted differently when it forms part of the INTERNATIONAL format
and NATIONAL format. A case in point is mobile numbers in Argentina:
The number, which would be written in INTERNATIONAL format as
+54 9 343 555 1212, will be written as 0343 15 555 1212 for NATIONAL
format. In this case, the prefix 9 is inserted when dialling from
overseas, but otherwise the prefix 0 and the carrier selection code
15 (inserted after the area code of 343) is used.
Note: this field is populated by setting a value for
Examples:
To set the
To have a format only used for national formatting, set
main_country_for_code: Option<bool>This field is set when this country is considered to be the main country for a calling code. It may not be set by more than one country with the same calling code, and it should not be set by countries with a unique calling code. This can be used to indicate that “GB” is the main country for the calling code “44” for example, rather than Jersey or the Isle of Man.
leading_digits: Option<String>This field is shadowed by the wrapper and is intentionally left empty. Access the underlying data via .original.
This field is populated only for countries or regions that share a country calling code. If a number matches this pattern, it could belong to this region. This is not intended as a replacement for IsValidForRegion since a matching prefix is insufficient for a number to be valid. Furthermore, it does not contain all the prefixes valid for a region - for example, 800 numbers are valid for all NANPA countries and are hence not listed here. This field should be a regular expression of the expected prefix match. It is used merely as a short-cut for working out which region a number comes from in the case that there is only one, so leading_digit prefixes should not overlap.
mobile_number_portable_region: Option<bool>This field is set when this country has implemented mobile number portability. This means that transferring mobile numbers between carriers is allowed. A consequence of this is that phone prefix to carrier mapping is less reliable.
Implementations§
Source§impl PhoneMetadata
impl PhoneMetadata
Sourcepub fn country_code(&self) -> i32
pub fn country_code(&self) -> i32
Returns the value of country_code, or the default value if country_code is unset.
Sourcepub fn international_prefix(&self) -> &str
pub fn international_prefix(&self) -> &str
Returns the value of international_prefix, or the default value if international_prefix is unset.
Sourcepub fn national_prefix(&self) -> &str
pub fn national_prefix(&self) -> &str
Returns the value of national_prefix, or the default value if national_prefix is unset.
Sourcepub fn preferred_extn_prefix(&self) -> &str
pub fn preferred_extn_prefix(&self) -> &str
Returns the value of preferred_extn_prefix, or the default value if preferred_extn_prefix is unset.
Sourcepub fn national_prefix_for_parsing(&self) -> &str
pub fn national_prefix_for_parsing(&self) -> &str
Returns the value of national_prefix_for_parsing, or the default value if national_prefix_for_parsing is unset.
Sourcepub fn national_prefix_transform_rule(&self) -> &str
pub fn national_prefix_transform_rule(&self) -> &str
Returns the value of national_prefix_transform_rule, or the default value if national_prefix_transform_rule is unset.
Sourcepub fn preferred_international_prefix(&self) -> &str
pub fn preferred_international_prefix(&self) -> &str
Returns the value of preferred_international_prefix, or the default value if preferred_international_prefix is unset.
Sourcepub fn same_mobile_and_fixed_line_pattern(&self) -> bool
pub fn same_mobile_and_fixed_line_pattern(&self) -> bool
Returns the value of same_mobile_and_fixed_line_pattern, or the default value if same_mobile_and_fixed_line_pattern is unset.
Sourcepub fn main_country_for_code(&self) -> bool
pub fn main_country_for_code(&self) -> bool
Returns the value of main_country_for_code, or the default value if main_country_for_code is unset.
Sourcepub fn leading_digits(&self) -> &str
pub fn leading_digits(&self) -> &str
Returns the value of leading_digits, or the default value if leading_digits is unset.
Sourcepub fn mobile_number_portable_region(&self) -> bool
pub fn mobile_number_portable_region(&self) -> bool
Returns the value of mobile_number_portable_region, or the default value if mobile_number_portable_region is unset.
Trait Implementations§
Source§impl Clone for PhoneMetadata
impl Clone for PhoneMetadata
Source§fn clone(&self) -> PhoneMetadata
fn clone(&self) -> PhoneMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PhoneMetadata
impl Debug for PhoneMetadata
Source§impl Default for PhoneMetadata
impl Default for PhoneMetadata
Source§impl Message for PhoneMetadata
impl Message for PhoneMetadata
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for PhoneMetadata
impl PartialEq for PhoneMetadata
Source§fn eq(&self, other: &PhoneMetadata) -> bool
fn eq(&self, other: &PhoneMetadata) -> bool
self and other values to be equal, and is used by ==.