File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -61,11 +61,6 @@ fn render_template(
61
61
EMAIL_ENV . get_template ( template_name) ?. render ( context)
62
62
}
63
63
64
- pub trait Email {
65
- fn subject ( & self ) -> String ;
66
- fn body ( & self ) -> String ;
67
- }
68
-
69
64
#[ derive( Debug , Clone ) ]
70
65
pub struct EmailMessage {
71
66
pub subject : String ,
@@ -84,16 +79,6 @@ impl EmailMessage {
84
79
}
85
80
}
86
81
87
- impl Email for EmailMessage {
88
- fn subject ( & self ) -> String {
89
- self . subject . clone ( )
90
- }
91
-
92
- fn body ( & self ) -> String {
93
- self . body_text . clone ( )
94
- }
95
- }
96
-
97
82
#[ derive( Debug , Clone ) ]
98
83
pub struct Emails {
99
84
backend : EmailBackend ,
@@ -194,8 +179,8 @@ impl Emails {
194
179
Ok ( message)
195
180
}
196
181
197
- pub async fn send < E : Email > ( & self , recipient : & str , email : E ) -> Result < ( ) , EmailError > {
198
- let email = self . build_message ( recipient, email. subject ( ) , email. body ( ) ) ?;
182
+ pub async fn send ( & self , recipient : & str , email : EmailMessage ) -> Result < ( ) , EmailError > {
183
+ let email = self . build_message ( recipient, email. subject , email. body_text ) ?;
199
184
200
185
self . backend
201
186
. send ( email)
You can’t perform that action at this time.
0 commit comments