tokio-rs / axum

Ergonomic and modular web framework built with Tokio, Tower, and Hyper

Repository from Github https://github.comtokio-rs/axumRepository from Github https://github.comtokio-rs/axum

feat(axum-core): move axum::Router to axum-core

dzmitry-lahoda opened this issue · comments

  • I have looked for existing issues (including closed) about this

Feature Request

move axum::Router to axum-core

Motivation

because tonic uses it
https://github.com/hyperium/tonic/blob/72b0fd59442d71804d4104e313ef6f140ab8f6d1/tonic/src/service/mod.rs#L15

because open-telemetry/opentelemetry-rust#2720

and I got weird build issues.

so I expect such low level libs to use axum-core, not axum (they actually do not even use axum web api features, just tonic uses some nice code from axum).

Proposal

  • axum_core::routing::Router and relevant code enough to move tonic from axum to axum-core.

Alternatives

  • patch when needed
[patch.crates-io]
# i used axum-extra 0.10 which works on only with axum 0.8
# while opentelemetry drags all features tonic which drags axum 0.7.9
# but we do not use axum integration of opentelemetry at all...
tonic = { rev = "ab19a89ccf7b57de59942e3d334b36dd4af137be", git = "https://github.com/dzmitry-lahoda-forks/tonic/"}
  • why at all tonic depends on axum::Router, can we somehow use opentelemetry with tonic but without axum::Router? may be tonic need to be fixed?

I can do it if it is fine to do so.

axum-core is the minimal building blocks for implementing extractors and response types. Router is way more complex, moving it there would defeat the purpose of the core crate.

I don't know why tonic depends on axum by the way, you should ask tonic and not us.