pub trait ValidatePhoneNumber {
// Required method
fn as_phone_number_string(&self) -> Cow<'_, str>;
// Provided method
fn validate_phone_number(&self, country_id_str: Option<&str>) -> bool { ... }
}Expand description
A trait for types that can be validated as a phone number.
Implementors must provide a way to get the phone number as a string
via the as_phone_number_string method.
Required Methods§
Sourcefn as_phone_number_string(&self) -> Cow<'_, str>
fn as_phone_number_string(&self) -> Cow<'_, str>
Returns the phone number as a Cow<str>.
Provided Methods§
Sourcefn validate_phone_number(&self, country_id_str: Option<&str>) -> bool
fn validate_phone_number(&self, country_id_str: Option<&str>) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<T: AsRef<str>> ValidatePhoneNumber for T
Implements ValidatePhoneNumber for any type that can be converted to a string slice (AsRef<str>).