[−][src]Struct phonenumber::PhoneNumber
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]
&'n self,
database: &'d Database
) -> Formatter<'n, 'd, 'static>
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]
fn eq(&self, other: &PhoneNumber) -> bool
[src]
fn ne(&self, other: &PhoneNumber) -> bool
[src]
impl Clone for PhoneNumber
[src]
fn clone(&self) -> 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<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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.
fn from_str(s: &str) -> Result<Self, Error>
[src]
impl Serialize for PhoneNumber
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for PhoneNumber
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Send for PhoneNumber
impl Sync for PhoneNumber
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,