enhancement(common_utils): impl from for email newtype (#1074)

This commit is contained in:
ItsMeShashank
2023-05-08 19:53:14 +05:30
committed by GitHub
parent b760cba546
commit 7c6f0fdec5
2 changed files with 11 additions and 5 deletions

View File

@ -122,6 +122,12 @@ where
#[diesel(sql_type = diesel::sql_types::Text)]
pub struct Email(Secret<String, EmailStrategy>);
impl From<Secret<String, EmailStrategy>> for Email {
fn from(value: Secret<String, EmailStrategy>) -> Self {
Self(value)
}
}
impl ops::Deref for Email {
type Target = Secret<String, EmailStrategy>;