2 releases
0.1.1 | Jul 5, 2022 |
---|---|
0.1.0 | Jul 5, 2022 |
#23 in #statsd
8KB
133 lines
Mock StatsD for Rust
Mock for statsd crate.
Usage
Add the statsd-mock
package as a dev dependency in your Cargo.toml
file
[dev-dependencies]
statsd-mock = "0.1"
Example
use statsd::client::Client;
fn main() {
// Start the mock server
let mock = statsd_mock::start();
// mock.addr() to get mock server address
let client = Client::new(&mock.addr(), "myapp").unwrap();
// Capturing
let response = mock.capture(|| client.incr("some.counter"));
assert_eq!(response, "myapp.some.counter:1|c");
}
License
MIT.
Dependencies
~425KB