https://github.com/fitzgen/tokio-timeit-middleware
https://github.com/fitzgen/tokio-timeit-middleware
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/fitzgen/tokio-timeit-middleware
- Owner: fitzgen
- License: apache-2.0
- Created: 2016-09-10T05:29:42.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-06T02:11:45.000Z (over 9 years ago)
- Last Synced: 2025-03-17T11:59:45.411Z (over 1 year ago)
- Language: Rust
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# tokio-timeit-middleware

Time how long it takes your Tokio `Service` to send a `Service::Response` in
reply to a `Service::Request`.
## Usage
First, add this to your Cargo.toml:
```toml
[dependencies]
tokio-timeit-middleware = { git = "https://github.com/fitzgen/tokio-timeit-middleware" }
```
Next, add this to your crate:
```rust
extern crate tokio_timeit_middleware;
```
To time your Tokio `Service`'s request/response times, wrap it in
`tokio_timeit_middleware::Timeit`:
```rust
let timed_service = Timeit::new(my_tokio_service, Rc::new(|duration| {
println!("Responded to request in {}", duration);
));
```