Skip to content

Commit 1e951a8

Browse files
authored
Add how to use puffin http (#105)
1 parent 1efc17b commit 1e951a8

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

puffin_http/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,16 @@
88
A HTTP server/client for communicating [`puffin`](https://github.com/EmbarkStudios/puffin) profiling events.
99

1010
You can view them using [`puffin_viewer`](https://github.com/EmbarkStudios/puffin/tree/main/puffin_viewer).
11+
12+
## How to use
13+
Add a `puffin_http` `Server` to the profiled application
14+
When the server is started, [`puffin_viewer`](https://crates.io/crates/puffin_viewer) application can connect to it and display profiling informations.
15+
16+
``` rust
17+
fn main() {
18+
let server_addr = format!("0.0.0.0:{}", puffin_http::DEFAULT_PORT);
19+
puffin_http::Server::new(&server_addr).unwrap();
20+
}
21+
```
22+
23+
You can checkout the examples/server.rs for a more complete example.

puffin_http/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
//! `puffin_server` is a library for streaming `puffin` profiler data over TCP.
2+
//!
3+
//! # How to use
4+
//! Add a `puffin_http` `Server` to the profiled application.
5+
//! When the server is started, [`puffin_viewer`](https://crates.io/crates/puffin_viewer) application can connect to it and display profiling informations.
6+
//!
7+
//! ```
8+
//! let server_addr = format!("0.0.0.0:{}", puffin_http::DEFAULT_PORT);
9+
//! puffin_http::Server::new(&server_addr).unwrap();
10+
//! ```
211
312
// BEGIN - Embark standard lints v5 for Rust 1.55+
413
// do not change or add/remove here, but one can add exceptions after this section

0 commit comments

Comments
 (0)