Skip to main content

Axum的路由模块

什么是路由

服务(Service)和处理程序(handler)之间的路由

重新导出

pub use self::method_routing::any;
pub use self::method_routing::any_service;
pub use self::method_routing::delete;
pub use self::method_routing::delete_service;
pub use self::method_routing::get;
pub use self::method_routing::get_service;
pub use self::method_routing::head;
pub use self::method_routing::head_service;
pub use self::method_routing::on;
pub use self::method_routing::on_service;
pub use self::method_routing::options;
pub use self::method_routing::options_service;
pub use self::method_routing::patch;
pub use self::method_routing::patch_service;
pub use self::method_routing::post;
pub use self::method_routing::post_service;
pub use self::method_routing::put;
pub use self::method_routing::put_service;
pub use self::method_routing::trace;
pub use self::method_routing::trace_service;
pub use self::method_routing::MethodRouter;

模块

  • future: Future类型
  • method_routing: 根据HTTP方法将请求路由到服务和处理程序。

结构体

-IntoMakeService: 生成axum路由服务的MakeService。 -MethodFilter: 匹配一个或多个HTTP方法的过滤器。 -Route: 路由在Router中存储的方式。 -Router: 用于组合处理程序和服务的路由器类型。 -RouterAsService: Router转换为具有固定body类型的借用服务。 -RouterIntoService: Router转换为具有固定body类型的拥有服务。