mirror of
https://github.com/kristoferssolo/zero2prod.git
synced 2025-10-21 20:10:40 +00:00
refactor: use string slices
This commit is contained in:
parent
241fe4953f
commit
2ebb54ef0f
@ -32,11 +32,11 @@ impl EmailClient {
|
|||||||
.and_then(|path| path.join("email"))
|
.and_then(|path| path.join("email"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let request_body = SendEmailRequest {
|
let request_body = SendEmailRequest {
|
||||||
from: self.sender.as_ref().to_owned(),
|
from: self.sender.as_ref(),
|
||||||
to: recipient.as_ref().to_owned(),
|
to: recipient.as_ref(),
|
||||||
subject: subject.to_owned(),
|
subject,
|
||||||
html_body: html_content.to_owned(),
|
html_body: html_content,
|
||||||
text_body: text_content.to_owned(),
|
text_body: text_content,
|
||||||
};
|
};
|
||||||
let builder = self
|
let builder = self
|
||||||
.http_client
|
.http_client
|
||||||
@ -51,12 +51,12 @@ impl EmailClient {
|
|||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[serde(rename_all = "PascalCase")]
|
#[serde(rename_all = "PascalCase")]
|
||||||
struct SendEmailRequest {
|
struct SendEmailRequest<'a> {
|
||||||
from: String,
|
from: &'a str,
|
||||||
to: String,
|
to: &'a str,
|
||||||
subject: String,
|
subject: &'a str,
|
||||||
html_body: String,
|
html_body: &'a str,
|
||||||
text_body: String,
|
text_body: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user