Skip to content

Fix channel example in async blog post#104

Merged
mre merged 1 commit into
masterfrom
fix-async-channel-example
May 9, 2026
Merged

Fix channel example in async blog post#104
mre merged 1 commit into
masterfrom
fix-async-channel-example

Conversation

@mre
Copy link
Copy Markdown
Member

@mre mre commented May 9, 2026

Fixes the channel example in the async blog post so it actually sends file contents through the channel.

  • Each spawned task now sends contents via tx with a proper Result<(), Box<dyn Error + Send + Sync>> return type so ? works on both fs::read_to_string and tx.send
  • Clones tx per task and drops the original after the scope so the rx loop terminates
  • Removes unused imports
  • Updates playground link
  • Bumps updated date

@mre mre merged commit 41e8530 into master May 9, 2026
2 checks passed
@mre mre deleted the fix-async-channel-example branch May 9, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant