Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions chompfile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ deps = ['install:ts-gen']
# implicit "every input is its own export" default is disabled.
run = '''ts-gen --input types/email.d.ts --output worker/src/bindings/email.rs \
--errors-as-error \
--experimental-generic-mono \
--export types/email.d.ts \
--export cloudflare:email \
--external "Env=crate::Env" \
--external "ExecutionContext=crate::Context"
ts-gen --input types/email.d.ts --output worker-sys/src/types/email.rs \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worker-sys/src/types/email.rs isn't wired into worker-sys at all (no mod email; in worker-sys/src/types.rs) — it's an orphan from #996. Delete the file instead of adding this second invocation.

--errors-as-error \
--experimental-generic-mono \
--export types/email.d.ts \
--export cloudflare:email \
--external "Env=crate::Env" \
Expand Down
2 changes: 1 addition & 1 deletion examples/receive-email/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn email(message: ForwardableEmailMessage, _env: Env, _ctx: Context) -> Re
.write_to_string()
.map_err(|e| Error::RustError(e.to_string()))?;

let reply = email::EmailMessage::new(&to, &from, &raw)?;
let reply = email::EmailMessage::new(to, from, raw)?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is required because &String no longer satisfies the generic bound — which is a source break for downstream users of the released EmailMessage::new. See the review summary: this needs JsStringLike for &String upstream in wasm-bindgen first, after which this diff (and the send-email / test ones) can be reverted.

message.reply(&reply).await?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion examples/send-email/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ async fn send_raw_mime(sender: &email::SendEmail) -> Result<email::EmailSendResu
.write_to_string()
.map_err(|e| Error::RustError(e.to_string()))?;

let message = email::EmailMessage::new(SENDER, RECIPIENT, &raw)?;
let message = email::EmailMessage::new(SENDER, RECIPIENT, raw)?;
Ok(sender.send(&message).await?)
}
6 changes: 1 addition & 5 deletions test/src/send_email.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,7 @@ pub async fn handle_send_email(req: Request, env: Env, _data: SomeSharedData) ->
}

async fn dispatch_mime(sender: &SendEmail, scenario: &MimeScenario) -> Result<String> {
let message = EmailMessage::new(
scenario.envelope_from,
scenario.envelope_to,
&scenario.raw(),
)?;
let message = EmailMessage::new(scenario.envelope_from, scenario.envelope_to, scenario.raw())?;
let result = sender.send(&message).await?;
Ok(result.message_id())
}
Expand Down
Loading
Loading