Struct serde_email::Email
source · pub struct Email { /* private fields */ }
Expand description
A validated Email object.
These can be created from a string using Email::from_string
,
Email::from_str
, or String::parse
.
Once built you can turn this like a String
, use with Serde, or Sea Orm.
Note that Email objects are case sensetive.
The email addresses Email::from_str("bob@example.com")
and Email::from_str("BoB@example.com")
,
will not be equal to each other.
Implementations§
source§impl Email
impl Email
sourcepub fn from_string(raw_email: String) -> Result<Self, EmailError>
pub fn from_string(raw_email: String) -> Result<Self, EmailError>
Creates a new Email, from the String
given.
If the given string doesn’t look like a valid email, then this will return an EmailError.
sourcepub fn from_str<S>(raw_email: S) -> Result<Self, EmailError>
pub fn from_str<S>(raw_email: S) -> Result<Self, EmailError>
Creates a new Email, from the str
given.
If the given string doesn’t look like a valid email, then this will return an EmailError.
sourcepub fn to_lowercase(&self) -> Self
pub fn to_lowercase(&self) -> Self
Returns a new Email, where the email has been uppercased.
sourcepub fn to_uppercase(&self) -> Self
pub fn to_uppercase(&self) -> Self
Returns a new Email, where the internal email has been uppercased.
pub fn as_str<'a>(&'a self) -> &'a str
Trait Implementations§
source§impl Default for Email
impl Default for Email
This is a common default, provided in use for stuff like tests.
The default email is default@example.com
.
source§impl<'de> Deserialize<'de> for Email
impl<'de> Deserialize<'de> for Email
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>,
impl Eq for Email
impl StructuralPartialEq for Email
Auto Trait Implementations§
impl Freeze for Email
impl RefUnwindSafe for Email
impl Send for Email
impl Sync for Email
impl Unpin for Email
impl UnwindSafe for Email
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)