Struct phonenumber::metadata::Descriptor
source · pub struct Descriptor { /* private fields */ }
Expand description
Description of a phone number to parse.
Implementations§
source§impl Descriptor
impl Descriptor
sourcepub fn national_number(&self) -> &CachedRegex
pub fn national_number(&self) -> &CachedRegex
The national number is the pattern that a valid national significant number would match. This specifies information such as its total length and leading digits.
sourcepub fn possible_length(&self) -> &[u16]
pub fn possible_length(&self) -> &[u16]
These represent the lengths a phone number from this region can be. They will be sorted from smallest to biggest. Note that these lengths are for the full number, without country calling code or national prefix. For example, for the Swiss number +41789270000, in local format 0789270000, this would be 9.
This could be used to highlight tokens in a text that may be a phone number, or to quickly prune numbers that could not possibly be a phone number for this locale.
sourcepub fn possible_local_length(&self) -> &[u16]
pub fn possible_local_length(&self) -> &[u16]
These represent the lengths that only local phone numbers (without an area code) from this region can be. They will be sorted from smallest to biggest. For example, since the American number 456-1234 may be locally diallable, although not diallable from outside the area, 7 could be a possible value. This could be used to highlight tokens in a text that may be a phone number.
To our knowledge, area codes are usually only relevant for some fixed-line and mobile numbers, so this field should only be set for those types of numbers (and the general description) - however there are exceptions for NANPA countries.
This data is used to calculate whether a number could be a possible number for a particular type.
Trait Implementations§
source§impl Clone for Descriptor
impl Clone for Descriptor
source§fn clone(&self) -> Descriptor
fn clone(&self) -> Descriptor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more