Skip to main content

RouteDocumentation

Trait RouteDocumentation 

Source
pub trait RouteDocumentation {
    // Required method
    fn collect_openapi_paths(&self, base_path: &str) -> Vec<(String, PathItem)>;

    // Provided method
    fn generate_openapi_doc(
        &self,
        title: &str,
        version: &str,
        description: Option<&str>,
    ) -> OpenApiDoc { ... }
}
Expand description

路由文档收集trait

为Silent的Route提供文档收集能力。

Required Methods§

Source

fn collect_openapi_paths(&self, base_path: &str) -> Vec<(String, PathItem)>

收集路由的文档信息

§参数
  • base_path: 基础路径前缀
§返回

返回路径和对应的OpenAPI PathItem的映射

Provided Methods§

Source

fn generate_openapi_doc( &self, title: &str, version: &str, description: Option<&str>, ) -> OpenApiDoc

生成完整的OpenAPI文档

§参数
  • title: API标题
  • version: API版本
  • description: API描述
§返回

返回完整的OpenAPI文档

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RouteDocumentation for Route

Source§

fn collect_openapi_paths(&self, base_path: &str) -> Vec<(String, PathItem)>

Implementors§