[−][src]Struct phonenumber::PhoneNumber
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]
&'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 Clone for PhoneNumber
[src]
fn clone(&self) -> PhoneNumber
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PhoneNumber
[src]
impl<'de> Deserialize<'de> for PhoneNumber
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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.
fn from_str(s: &str) -> Result<Self, Self::Err>
[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,
impl PartialEq<PhoneNumber> for PhoneNumber
[src]
fn eq(&self, other: &PhoneNumber) -> bool
[src]
fn ne(&self, other: &PhoneNumber) -> bool
[src]
impl Serialize for PhoneNumber
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for PhoneNumber
[src]
impl StructuralPartialEq for PhoneNumber
[src]
Auto Trait Implementations
impl RefUnwindSafe for PhoneNumber
impl Send for PhoneNumber
impl Sync for PhoneNumber
impl Unpin for PhoneNumber
impl UnwindSafe for PhoneNumber
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,