pub struct StatsDServer { /* private fields */ }Implementations§
Source§impl StatsDServer
impl StatsDServer
pub fn new() -> Self
Sourcepub fn run_while_receiving_all<F>(self, func: F) -> Vec<String>where
F: Fn(),
pub fn run_while_receiving_all<F>(self, func: F) -> Vec<String>where
F: Fn(),
Run the given test function while receiving several packets. Return a vector of the packets.
use statsd::Client;
// Start the mock server
let mock = statsd_mock::start();
let client = Client::new(&mock.addr(), "duyet").unwrap();
let response = mock.run_while_receiving_all(|| {
client.incr("some.counter");
client.count("some.counter", 123.0);
});
assert_eq!(
response,
vec!["duyet.some.counter:1|c", "duyet.some.counter:123|c"]
);Sourcepub fn capture_all<F>(self, func: F) -> Vec<String>where
F: Fn(),
pub fn capture_all<F>(self, func: F) -> Vec<String>where
F: Fn(),
Run the given test function while receiving several packets. Return a vector of the packets.
Sourcepub fn run_while_receiving<F>(self, func: F) -> Stringwhere
F: Fn(),
pub fn run_while_receiving<F>(self, func: F) -> Stringwhere
F: Fn(),
Run the given test function while receiving several packets. Return the concatenation of the packets.
use statsd::Client;
// Start the mock server
let mock = statsd_mock::start();
let client = Client::new(&mock.addr(), "duyet").unwrap();
let response = mock.run_while_receiving(|| {
client.count("some.counter", 123.0);
});
assert_eq!(response, "duyet.some.counter:123|c");Trait Implementations§
Auto Trait Implementations§
impl Freeze for StatsDServer
impl RefUnwindSafe for StatsDServer
impl Send for StatsDServer
impl Sync for StatsDServer
impl Unpin for StatsDServer
impl UnwindSafe for StatsDServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more