File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ 0.21.1]
8+
9+ ### Added
10+
11+ - Implement ` EncodeLabelValue ` for ` Option<T> ` .
12+ See [ PR 137] .
13+
14+ [ PR 137 ] : https://github.com/prometheus/client_rust/pull/137
15+
716## [ 0.21.0]
817
918### Changed
Original file line number Diff line number Diff line change 11[package ]
22name = " prometheus-client"
3- version = " 0.21.0 "
3+ version = " 0.21.1 "
44authors = [" Max Inden <mail@max-inden.de>" ]
55edition = " 2021"
66description = " Open Metrics client library allowing users to natively instrument applications."
Original file line number Diff line number Diff line change @@ -404,6 +404,18 @@ impl EncodeLabelValue for f64 {
404404 }
405405}
406406
407+ impl < T > EncodeLabelValue for Option < T >
408+ where
409+ T : EncodeLabelValue ,
410+ {
411+ fn encode ( & self , encoder : & mut LabelValueEncoder ) -> Result < ( ) , std:: fmt:: Error > {
412+ match self {
413+ Some ( v) => EncodeLabelValue :: encode ( v, encoder) ,
414+ None => EncodeLabelValue :: encode ( & "" , encoder) ,
415+ }
416+ }
417+ }
418+
407419macro_rules! impl_encode_label_value_for_integer {
408420 ( $( $t: ident) ,* ) => { $(
409421 impl EncodeLabelValue for $t {
You can’t perform that action at this time.
0 commit comments