pub trait ToAddress {
// Required method
fn to_address(&self) -> Address;
}Expand description
Trait for types that can be converted to an email address.
Implement this trait for your custom types to use them directly in email builder methods.
§Example
use missive::{Address, ToAddress};
struct User {
name: String,
email: String,
}
impl ToAddress for User {
fn to_address(&self) -> Address {
Address::with_name(&self.name, &self.email)
}
}
// Now you can use User directly:
// let email = Email::new().to(&user);