Skip to content

refactor!: mark public types as non_exhaustive#4107

Merged
Frando merged 2 commits intomainfrom
Frando/pub-nonexhaustive
Apr 13, 2026
Merged

refactor!: mark public types as non_exhaustive#4107
Frando merged 2 commits intomainfrom
Frando/pub-nonexhaustive

Conversation

@Frando
Copy link
Copy Markdown
Member

@Frando Frando commented Apr 13, 2026

Description

Add #[non_exhaustive] to various public structs and enums that we might want to extend during 1.0:

  • structs: relay_map::RelayConfig, relay_map::RelayQuicConfig
  • enums: DirectAddrType, DiscoveryEvent: enums
  • enums in iroh_relay: RelayToClientMsg, ClientToRelayMsg, FrameType

There's more items in the server-side of iroh-relay, will do those separately.

Breaking Changes

  • iroh_relay::RelayConfig is now #[non_exhaustive]. Use RelayConfig::from(relay_url) for the common case, or RelayConfig::new(url, quic) to specify a custom QUIC config.
  • iroh_relay::RelayQuicConfig is now #[non_exhaustive]. Use RelayQuicConfig::new(port) or RelayQuicConfig::default() instead of struct literals.
  • iroh_relay::protos::relay::RelayToClientMsg is now #[non_exhaustive].
  • iroh_relay::protos::relay::ClientToRelayMsg is now #[non_exhaustive].
  • iroh_relay::protos::common::FrameType is now #[non_exhaustive].
  • iroh::DirectAddrType is now #[non_exhaustive].
  • iroh::address_lookup::mdns::DiscoveryEvent is now #[non_exhaustive].
  • iroh_relay::server::Metrics is now #[non_exhaustive]. Use Metrics::default() instead of struct literals.
  • iroh_relay::server::RelayMetrics is now #[non_exhaustive]. Use RelayMetrics::default() instead of struct literals.

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.
    • List all breaking changes in the above "Breaking Changes" section.
    • Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are:

@n0bot n0bot bot added this to iroh Apr 13, 2026
@github-project-automation github-project-automation bot moved this to 🚑 Needs Triage in iroh Apr 13, 2026
@Frando Frando force-pushed the Frando/pub-nonexhaustive branch 2 times, most recently from c8e4d2a to d40a9ba Compare April 13, 2026 11:18
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/4107/docs/iroh/

Last updated: 2026-04-13T12:15:59Z

@Frando Frando force-pushed the Frando/pub-nonexhaustive branch from d40a9ba to e46136a Compare April 13, 2026 11:36
Frando added 2 commits April 13, 2026 14:12
Add `#[non_exhaustive]` to public structs and enums that external code
should not construct or match exhaustively:

- `RelayConfig`, `RelayQuicConfig` (relay_map): add constructors
- `DirectAddrType`, `DiscoveryEvent`: enums
- `RelayToClientMsg`, `ClientToRelayMsg`, `FrameType`: protocol enums
- Update call sites to use `From`/`new()` instead of struct literals
@Frando Frando force-pushed the Frando/pub-nonexhaustive branch from aa22447 to 60a01b9 Compare April 13, 2026 12:14
@github-actions
Copy link
Copy Markdown

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: aa5e0ae

@Frando Frando merged commit 86d3ac6 into main Apr 13, 2026
31 of 32 checks passed
@github-project-automation github-project-automation bot moved this from 🚑 Needs Triage to ✅ Done in iroh Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants