Repository navigation
feat(server): infer route path type via impl AsRef<str> parameter - #43
Merged
Merged
Conversation
Drop the explicit P generic from Server::route so callers write
route::<TestRoute>("/") without naming the path type. The path now
arrives as impl AsRef<str> (the inference-shim exemption in
rust-standards section 9.2a), which keeps &str, String and &String
call sites compiling unchanged while removing the mandatory second
turbofish parameter.
BREAKING CHANGE: turbofish call sites that named the path type
explicitly (route::<T, &str>(path)) no longer compile, because the
method now takes exactly one generic argument. All 42 in-tree call
sites in core/tests and plugin/websocket/tests were updated in this
commit, and a new route_path_type_inference test proves &str,
String, &String and chained registration all infer correctly.
Bump the workspace version 21.11.0 -> 21.12.0 (minor carries the
breaking change under the workspace release convention) and sync
the workspace.dependencies path versions via crate sync.
vshengbro
added a commit
to hyperlane-dev/hyperlane-quick-start
that referenced
this pull request
Oct 9, 2026
hyperlane-core 21.12.0 changes Server::route to take path: impl AsRef<str>; this branch registers routes through the #[route] attribute macro (inventory-based), which never calls Server::route, so no call sites change here. The same release reduces several http-constant header-name constants to pub(crate) visibility (rust-standards section 18): ACCEPT_RANGES, AUTHORIZATION, CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_RANGE, DATE, EXPIRES and RANGE were consumed across the application crate's controllers, views, services and middleware. They now live as one local copy in application/const.rs per the section 18 consumer guidance, re-exported crate-internally from application/lib.rs. Cargo.lock intentionally still pins 21.10.0: crates.io serves 21.12.0 only after hyperlane-dev/hyperlane#43 merges and the publish workflow runs. Run cargo update -p hyperlane after that to refresh the lockfile.
vshengbro
added a commit
to hyperlane-dev/hyperlane-quick-start
that referenced
this pull request
Oct 9, 2026
hyperlane-core 21.12.0 changes Server::route to take path: impl AsRef<str>; this branch registers routes through the #[route] attribute macro (inventory-based), which never calls Server::route, so no call sites change here. The same release reduces several http-constant header-name constants to pub(crate) visibility (rust-standards section 18): ACCEPT_RANGES, AUTHORIZATION, CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_RANGE, DATE, EXPIRES and RANGE were consumed across the application crate's controllers, views, services and middleware. They now live as one local copy in application/header/const.rs per the section 18 consumer guidance, re-exported crate-internally from application/lib.rs. Cargo.lock intentionally still pins 21.10.0: crates.io serves 21.12.0 only after hyperlane-dev/hyperlane#43 merges and the publish workflow runs. Run cargo update -p hyperlane after that to refresh the lockfile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Server::routedrops its explicitPgeneric and takespath: impl AsRef<str>instead:Callers now write
server.route::<TestRoute>("/")without naming the path type. Theimpl AsRef<str>parameter is the inference shim exempted by rust-standards §9.2a, so&str,Stringand&Stringcall sites keep compiling and method chaining still works.Breaking change: turbofish call sites that named the path type explicitly (
route::<T, &str>(path)) no longer compile — the method now takes exactly one generic argument (E0107). All 42 in-tree call sites are updated in this commit:core/tests/route/fn.rs— 22 call sites + newroute_path_type_inferencetestcore/tests/server/fn.rs— 18 call sitesplugin/websocket/tests/websocket/fn.rs— 2 call sitesWorkspace version bumped 21.11.0 → 21.12.0 (
[workspace.package]only;[workspace.dependencies]path versions synced viacrate sync). The#[route]proc-macro registers routes viainventory::submit!+HookType::Routeand does not callServer::route, sohyperlane-macrosis unaffected.hyperlane-cliand the roothyperlaneshim never wraproute.Verification
cargo build --workspace— cleancargo clippy --workspace --all-targets— 0 warnings, 0 errorscargo test --workspace --all-features— all pass, 694 assertions total;route::r#fn::route_path_type_inference ... okcovers&str,String,&Stringand chained registrationcargo fmt --all+cargo fmt --all -- --check— 0 diff, idempotentorigin/masterbaseline (the single FAIL is check 49 §18 const-visibility, 2114 pre-existing hits in 12 files on both trees — zero new violations introduced by this change)staged_file_gate.py(pre-commit hook) — 0 new violations, commit allowedroute::<TestRoute, &str>("/")now fails with E0107 as expected — this is the breaking half of the change, which is why the call-site updates and the minor bump ship togetherNotes
eea52fa(PR chore: centralize test std imports into tests mod.rs (§6.4, check 26) #41) before commit; no overlap with that PR'stype/testsfiles.hyperlane-quick-start(master + playground) bumps itshyperlane/hyperlane-corerequirement to21.12.0once crates.io serves it.pub consthits) is pre-existing on master and out of scope here; it needs its own sweep PR.