Struct phonenumber::Metadata [] [src]

pub struct Metadata { /* fields omitted */ }

Phone number metadata.

Methods

impl Metadata
[src]

[src]

Descriptors for the various types of phone number.

[src]

The 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

[src]

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.

[src]

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.

[src]

If 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.

[src]

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.

[src]

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.

[src]

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.

[src]

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.

Important traits for &'a mut [u8]
[src]

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.

Important traits for &'a mut [u8]
[src]

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 inside the tag in the XML file. If is not set then it defaults to the same value as the tag.

Examples: To set the to a different value than the : $1 $2 $3 $1-$2-$3

To have a format only used for national formatting, set to "NA": $1 $2 $3 NA

[src]

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.

[src]

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.

[src]

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.

Trait Implementations

impl Clone for Metadata
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Metadata
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Metadata

impl Sync for Metadata