Struct phonenumber::PhoneNumber
source · pub struct PhoneNumber { /* private fields */ }
Expand description
A phone number.
Implementations§
source§impl PhoneNumber
impl PhoneNumber
sourcepub fn national(&self) -> &NationalNumber
pub fn national(&self) -> &NationalNumber
Get the national number.
sourcepub fn format(&self) -> Formatter<'_, 'static, 'static>
pub fn format(&self) -> Formatter<'_, 'static, 'static>
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);
sourcepub fn format_with<'n, 'd>(
&'n self,
database: &'d Database
) -> Formatter<'n, 'd, 'static>
pub fn format_with<'n, 'd>( &'n self, database: &'d Database ) -> Formatter<'n, 'd, 'static>
Prepare a formatter for this PhoneNumber
with the given Database
.
sourcepub fn metadata<'a>(&self, database: &'a Database) -> Option<&'a Metadata>
pub fn metadata<'a>(&self, database: &'a Database) -> Option<&'a Metadata>
Get the metadata that applies to this phone number from the given database.
sourcepub fn is_valid_with(&self, database: &Database) -> bool
pub fn is_valid_with(&self, database: &Database) -> bool
Check if the phone number is valid with the given Database
.
sourcepub fn number_type(&self, database: &Database) -> Type
pub fn number_type(&self, database: &Database) -> Type
Determine the Type
of the phone number.
Trait Implementations§
source§impl Clone for PhoneNumber
impl Clone for PhoneNumber
source§fn clone(&self) -> PhoneNumber
fn clone(&self) -> PhoneNumber
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PhoneNumber
impl Debug for PhoneNumber
source§impl<'de> Deserialize<'de> for PhoneNumber
impl<'de> Deserialize<'de> for PhoneNumber
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for PhoneNumber
impl Display for PhoneNumber
source§impl FromStr for PhoneNumber
impl FromStr for PhoneNumber
source§impl Hash for PhoneNumber
impl Hash for PhoneNumber
source§impl PartialEq<PhoneNumber> for PhoneNumber
impl PartialEq<PhoneNumber> for PhoneNumber
source§fn eq(&self, other: &PhoneNumber) -> bool
fn eq(&self, other: &PhoneNumber) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for PhoneNumber
impl Serialize for PhoneNumber
impl Eq for PhoneNumber
impl StructuralEq for PhoneNumber
impl StructuralPartialEq for PhoneNumber
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more