From 720d54622d754b270dd923516a9c78967c4d76e8 Mon Sep 17 00:00:00 2001 From: Cristiano Piemontese Date: Mon, 25 Nov 2024 15:53:51 +0100 Subject: [PATCH] update docs --- CHANGELOG.md | 5 +++++ src/lib.rs | 2 ++ src/tests/event_with_options.rs | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d382920..69d0d99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.9.0] - 2024-11-25 +### Added + +- New `event_with_options!` macro, [see the original repo](https://github.com/mcasper/dogstatsd-rs) for more details + ### Changed - Bump `dogstatsd` to 0.12 +- Bumped MSRV to 1.74 --- diff --git a/src/lib.rs b/src/lib.rs index 2cc0820..437c317 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,6 +57,8 @@ //! service_check!("test", ServiceStatus::OK, ServiceCheckOptions::default()); //! # event!("test", "test event"); //! event!("test", "test event"; "some" => "data"); +//! # event_with_options!("test", "test event", EventOptions::new()); +//! event_with_options!("test", "test event", EventOptions::new(); "some" => "data"); //! ``` //! //! This is an example of a custom metric, in this case based on an enum type, but it can really be diff --git a/src/tests/event_with_options.rs b/src/tests/event_with_options.rs index ba7735d..a942646 100644 --- a/src/tests/event_with_options.rs +++ b/src/tests/event_with_options.rs @@ -74,10 +74,18 @@ pub fn test_macro() { let tag = String::from("tag"); // no tags event_with_options!("test", "test_value"); + // no tags with options + event_with_options!("test", "test_value", EventOptions::new()); // just literal tags event_with_options!("test", "test_value"; "literal" => 1); + // just literal tags with options + event_with_options!("test", "test_value", EventOptions::new(); "literal" => 1); // just expression tags event_with_options!("test", "test_value"; "expression" => tag); + // just expression tags with options + event_with_options!("test", "test_value", EventOptions::new(); "expression" => tag); // mixed tags event_with_options!("test", "test_value"; "literal" => 1, "expression" => tag); + // mixed tags with options + event_with_options!("test", "test_value", EventOptions::new(); "literal" => 1, "expression" => tag); }