pub fn with_formatter<T: RouteFormatter + 'static>(route_formatter: T) -> Self {
        RequestTracing {
            route_formatter: Some(Rc::new(route_formatter)),
        }
    }
/// Actix web middleware to trace each request in an OpenTelemetry span with
/// formatted routes.
///
/// # Examples
///
/// ```no_run
/// use actix_web::{web, App, HttpServer};
/// use actix_web_opentelemetry::{RouteFormatter, RequestTracing};
///
/// # #[actix_web::main]
/// # async fn main() -> std::io::Result<()> {
///
///
/// #[derive(Debug)]
/// struct MyLowercaseFormatter;
///
/// impl RouteFormatter for MyLowercaseFormatter {
///     fn format(&self, path: &str) -> String {
///         path.to_lowercase()
///     }
/// }
///
/// // report /users/{id} as /users/:id
/// HttpServer::new(move || {
///     App::new()
///         .wrap(RequestTracing::with_formatter(MyLowercaseFormatter))
///         .service(web::resource("/users/{id}").to(|| async { "ok" }))
/// })
/// .bind("127.0.0.1:8080")?
/// .run()
/// .await
/// # }
/// ```
Actix web middleware to trace each request in an OpenTelemetry span with
formatted routes.
Actix web middleware to trace each request in an OpenTelemetry span with formatted routes .
pub fn with_formatter<T: RouteFormatter + 'static>(route_formatter: T) -> Self {
        RequestTracing {
            route_formatter: Some(Rc::new(route_formatter)),
        }
    }
pub fn with_formatter < T : RouteFormatter + ' static > ( route_formatter : T ) -> Self { RequestTracing { route_formatter : Some ( Rc :: new ( route_formatter ) ) , } }
Actix web middleware to trace each request in an OpenTelemetry span with
formatted routes.
Actix web middleware to trace each request in an OpenTelemetry span with formatted routes .
route_formatter
T
route_formatter
T
examples
```no_run
use actix_web::{web, App, HttpServer};
use actix_web_opentelemetry::{RouteFormatter, RequestTracing}.
` ` ` no_run use actix_web :: { web App HttpServer } ; use actix_web_opentelemetry :: { RouteFormatter RequestTracing } .
#[actix_web::main]
None
async fn main() -> std::io::result<()> {
None
[derive(debug)]
struct MyLowercaseFormatter.

impl RouteFormatter for MyLowercaseFormatter {
fn format(&self, path: &str) -> String {
path.to_lowercase()
}
}

report /users/{id} as /users/:id
HttpServer::new(move || {
App::new()
.wrap(RequestTracing::with_formatter(MyLowercaseFormatter))
.service(web::resource("/users/{id}").to(|| async { "ok" }))
})
.bind("127.0.0.1:8080").
.run()
.await
struct MyLowercaseFormatter . impl RouteFormatter for MyLowercaseFormatter { fn format ( &self path : &str ) - > String { path . to_lowercase () } } report / users / { id } as / users / : id HttpServer :: new ( move || { App :: new () . wrap ( RequestTracing :: with_formatter ( MyLowercaseFormatter )) . service ( web :: resource ( " / users / { id } " ) . to ( || async { " ok " } )) } ) . bind ( " 127 . 0 . 0 . 1 : 8080 " ) . . run () . await
}
None