Skip to content

Fix Rust custom relay example#67

Merged
matheus23 merged 1 commit into
mainfrom
rae/fix-custom-relay-snippet
Jun 12, 2026
Merged

Fix Rust custom relay example#67
matheus23 merged 1 commit into
mainfrom
rae/fix-custom-relay-snippet

Conversation

@okdistribute

@okdistribute okdistribute commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #53.

The Rust tab of the custom relay snippet (used by the dedicated infrastructure page) had three problems against iroh 1.0.0-rc.1:

  • RelayMode::Custom takes a RelayMap, not a Vec<RelayUrl> (the bug reported in Rust examples for custom relays are wrong #53). Now uses RelayMap::from_iter, which is implemented for RelayUrl iterators.
  • use iroh::relay::RelayUrl is not a valid path; RelayUrl is exported at the crate root.
  • Endpoint::builder() now requires a preset argument; passes presets::N0, matching the other language tabs which combine preset_n0() with a relay_mode override.

Verified the corrected example with cargo check against iroh@1.0.0-rc.1. The Python, Swift, and Kotlin tabs use the bindings' RelayMode.customFromUrls(...) API and are unchanged.

🤖 Generated with Claude Code

RelayMode::Custom takes a RelayMap, not a Vec<RelayUrl>, so the
previous example did not compile. Also fix the RelayUrl import path
(crate root, there is no iroh::relay module) and pass the now-required
preset to Endpoint::builder. Verified with cargo check against
iroh 1.0.0-rc.1.

Fixes #53

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
number0 🟢 Ready View Preview Jun 11, 2026, 8:28 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@matheus23 matheus23 merged commit 5d384ac into main Jun 12, 2026
3 checks passed
@matheus23 matheus23 deleted the rae/fix-custom-relay-snippet branch June 12, 2026 07:24
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.

Rust examples for custom relays are wrong

2 participants