Email and Password Type in Rust
Include:
rust
let correct_email = Email::new("example@example.com");
let incorrect_email = Email::new("example.com");
assert!(correct_email.is_ok());
assert!(incorrect_email.is_err());
```rust let unsafepassword = Password::new("01234".tostring); let safepassword = Password::new( "ThisIsAPassPhrase.An.Secure.Password".tostring(), );
assert!(unsafe_password.is_err());
assert!(safe_password.is_ok();
```
After initialization, you can't access the non encrypt value ```rust let mut password = Password::new( "ThisIsAPassPhrase.An.Secure.Password".tostring(), ); asserteq!(password.trytostr(), Err(Error::InexistentEncryptPassword));
password.encrypt_password().unwrap();
assert!(password.try_to_str().is_ok());
```