[][src]Struct phonenumber::PhoneNumber

pub struct PhoneNumber { /* fields omitted */ }

A phone number.

Implementations

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 Clone for PhoneNumber[src]

impl Debug for PhoneNumber[src]

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

impl Display for PhoneNumber[src]

impl Eq for PhoneNumber[src]

impl FromStr for PhoneNumber[src]

type Err = Parse

The associated error which can be returned from parsing.

impl Hash for PhoneNumber[src]

impl PartialEq<PhoneNumber> for PhoneNumber[src]

impl Serialize for PhoneNumber[src]

impl StructuralEq for PhoneNumber[src]

impl StructuralPartialEq for PhoneNumber[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.