@@ -500,6 +500,18 @@ impl EncodeGaugeValue for f64 {
500
500
}
501
501
}
502
502
503
+ impl EncodeGaugeValue for i32 {
504
+ fn encode ( & self , encoder : & mut GaugeValueEncoder ) -> Result < ( ) , std:: fmt:: Error > {
505
+ encoder. encode_i64 ( * self as i64 )
506
+ }
507
+ }
508
+
509
+ impl EncodeGaugeValue for f32 {
510
+ fn encode ( & self , encoder : & mut GaugeValueEncoder ) -> Result < ( ) , std:: fmt:: Error > {
511
+ encoder. encode_f64 ( * self as f64 )
512
+ }
513
+ }
514
+
503
515
/// Encoder for a gauge value.
504
516
#[ derive( Debug ) ]
505
517
pub struct GaugeValueEncoder < ' a > ( GaugeValueEncoderInner < ' a > ) ;
@@ -552,6 +564,24 @@ impl EncodeCounterValue for f64 {
552
564
}
553
565
}
554
566
567
+ impl EncodeCounterValue for u32 {
568
+ fn encode ( & self , encoder : & mut CounterValueEncoder ) -> Result < ( ) , std:: fmt:: Error > {
569
+ encoder. encode_u64 ( * self as u64 )
570
+ }
571
+ }
572
+
573
+ impl EncodeCounterValue for i32 {
574
+ fn encode ( & self , encoder : & mut CounterValueEncoder ) -> Result < ( ) , std:: fmt:: Error > {
575
+ encoder. encode_u64 ( * self as u64 )
576
+ }
577
+ }
578
+
579
+ impl EncodeCounterValue for f32 {
580
+ fn encode ( & self , encoder : & mut CounterValueEncoder ) -> Result < ( ) , std:: fmt:: Error > {
581
+ encoder. encode_f64 ( * self as f64 )
582
+ }
583
+ }
584
+
555
585
/// Encoder for a counter value.
556
586
#[ derive( Debug ) ]
557
587
pub struct CounterValueEncoder < ' a > ( CounterValueEncoderInner < ' a > ) ;
@@ -591,6 +621,18 @@ impl EncodeExemplarValue for u64 {
591
621
}
592
622
}
593
623
624
+ impl EncodeExemplarValue for f32 {
625
+ fn encode ( & self , mut encoder : ExemplarValueEncoder ) -> Result < ( ) , std:: fmt:: Error > {
626
+ encoder. encode ( * self as f64 )
627
+ }
628
+ }
629
+
630
+ impl EncodeExemplarValue for u32 {
631
+ fn encode ( & self , mut encoder : ExemplarValueEncoder ) -> Result < ( ) , std:: fmt:: Error > {
632
+ encoder. encode ( * self as f64 )
633
+ }
634
+ }
635
+
594
636
impl < ' a > From < text:: CounterValueEncoder < ' a > > for CounterValueEncoder < ' a > {
595
637
fn from ( e : text:: CounterValueEncoder < ' a > ) -> Self {
596
638
CounterValueEncoder ( CounterValueEncoderInner :: Text ( e) )
0 commit comments