pub struct PhoneNumber(/* private fields */);Expand description
Validated E.164-style phone number.
Implementations§
Source§impl PhoneNumber
impl PhoneNumber
Sourcepub fn new(value: impl AsRef<str>) -> Result<Self, PaymentError>
pub fn new(value: impl AsRef<str>) -> Result<Self, PaymentError>
Creates a phone number from digits with an optional leading +.
§Errors
Returns an error when the phone number is outside E.164 length bounds or contains unsupported characters.
Sourcepub fn new_digits(value: impl AsRef<str>) -> Result<Self, PaymentError>
pub fn new_digits(value: impl AsRef<str>) -> Result<Self, PaymentError>
Creates a phone number without adding the display + prefix.
§Errors
Returns an error when the number is invalid.
Trait Implementations§
Source§impl AsRef<str> for PhoneNumber
impl AsRef<str> for PhoneNumber
Source§impl Clone for PhoneNumber
impl Clone for PhoneNumber
Source§fn clone(&self) -> PhoneNumber
fn clone(&self) -> PhoneNumber
Returns a duplicate 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 Hash for PhoneNumber
impl Hash for PhoneNumber
Source§impl PartialEq for PhoneNumber
impl PartialEq for PhoneNumber
impl Eq for PhoneNumber
impl StructuralPartialEq for PhoneNumber
Auto Trait Implementations§
impl Freeze for PhoneNumber
impl RefUnwindSafe for PhoneNumber
impl Send for PhoneNumber
impl Sync for PhoneNumber
impl Unpin for PhoneNumber
impl UnsafeUnpin 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