[][src]Struct phonenumber::PhoneNumber

pub struct PhoneNumber { /* fields omitted */ }

A phone number.

Methods

impl PhoneNumber[src]

pub fn country(&self) -> Country[src]

Get information about the country for the phone number.

pub fn code(&self) -> &Code[src]

Get the country code.

pub fn national(&self) -> &NationalNumber[src]

Get the national number.

pub fn extension(&self) -> Option<&Extension>[src]

Get the extension.

pub fn carrier(&self) -> Option<&Carrier>[src]

Get the carrier.

pub fn format<'n>(&'n self) -> Formatter<'n, 'static, 'static>[src]

Prepare a formatter for this PhoneNumber.

Example

use phonenumber::{self, country, Mode};

let number = phonenumber::parse(Some(country::DE), "301/23456").unwrap()
    .format().mode(Mode::National).to_string();

assert_eq!("030 123456", number);

pub fn format_with<'n, 'd>(
    &'n self,
    database: &'d Database
) -> Formatter<'n, 'd, 'static>
[src]

Prepare a formatter for this PhoneNumber with the given Database.

pub fn metadata<'a>(&self, database: &'a Database) -> Option<&'a Metadata>[src]

Get the metadata that applies to this phone number from the given database.

pub fn is_valid(&self) -> bool[src]

Check if the phone number is valid.

pub fn is_valid_with(&self, database: &Database) -> bool[src]

Check if the phone number is valid with the given Database.

Trait Implementations

impl PartialEq<PhoneNumber> for PhoneNumber[src]

impl Clone for PhoneNumber[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for PhoneNumber[src]

impl Display for PhoneNumber[src]

impl Debug for PhoneNumber[src]

impl Hash for PhoneNumber[src]

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

Feeds a slice of this type into the given [Hasher]. Read more

impl FromStr for PhoneNumber[src]

type Err = Error

The associated error which can be returned from parsing.

impl Serialize for PhoneNumber[src]

impl<'de> Deserialize<'de> for PhoneNumber[src]

Auto Trait Implementations

impl Send for PhoneNumber

impl Sync for PhoneNumber

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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