Skip to content

Commit

Permalink
*/Cargo.toml: Update to 2021 edition (prometheus#65)
Browse files Browse the repository at this point in the history
As suggested in prometheus#64,
this commit update edition key of manifest file into 2021.

As documented in 2021 edition guide(https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html),
array.into_iter() now returns owned value instead of references,
This commit changes previous doc comments to utilize new behavior.

Signed-off-by: Doehyun Baek <[email protected]>
  • Loading branch information
doehyunbaek authored Jun 1, 2022
1 parent 63f0a92 commit 69e6674
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.17.0] - unreleased

### Changed

- Updates to Rust 2021 Edition. See [PR 65].

[PR 65]: https://github.com/prometheus/client_rust/pull/65

## [0.16.0]

### Changed
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "prometheus-client"
version = "0.16.0"
version = "0.17.0"
authors = ["Max Inden <[email protected]>"]
edition = "2018"
edition = "2021"
description = "Open Metrics client library allowing users to natively instrument applications."
license = "Apache-2.0 OR MIT"
keywords = ["openmetrics", "prometheus", "metrics", "instrumentation", "monitoring"]
Expand All @@ -17,7 +17,7 @@ members = ["derive-text-encode"]
dtoa = "1.0"
itoa = "1.0"
owning_ref = "0.4"
prometheus-client-derive-text-encode = { version = "0.2.0", path = "derive-text-encode" }
prometheus-client-derive-text-encode = { version = "0.3.0", path = "derive-text-encode" }

[dev-dependencies]
async-std = { version = "1", features = ["attributes"] }
Expand Down
4 changes: 2 additions & 2 deletions derive-text-encode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "prometheus-client-derive-text-encode"
version = "0.2.0"
version = "0.3.0"
authors = ["Max Inden <[email protected]>"]
edition = "2018"
edition = "2021"
description = "Auxiliary crate to derive text Encode trait from prometheus-client."
license = "Apache-2.0 OR MIT"
repository = "https://github.com/prometheus/client_rust"
Expand Down
4 changes: 2 additions & 2 deletions src/metrics/family.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ pub trait MetricConstructor<M> {
/// ```
/// # use prometheus_client::metrics::family::{Family};
/// # use prometheus_client::metrics::histogram::Histogram;
/// let custom_buckets = vec![0.0, 10.0, 100.0];
/// let custom_buckets = [0.0, 10.0, 100.0];
/// let metric = Family::<(), Histogram, _>::new_with_constructor(|| {
/// Histogram::new(custom_buckets.clone().into_iter())
/// Histogram::new(custom_buckets.into_iter())
/// });
/// # metric.get_or_create(&());
/// ```
Expand Down
5 changes: 3 additions & 2 deletions src/metrics/histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ use std::sync::{Arc, Mutex, MutexGuard};
/// ```
/// # use prometheus_client::metrics::histogram::Histogram;
/// // Default values from go client(https://github.com/prometheus/client_golang/blob/5d584e2717ef525673736d72cd1d12e304f243d7/prometheus/histogram.go#L68)
/// let histogram = Histogram::new(IntoIterator::into_iter([
/// let custom_buckets = [
/// 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0,
/// ]));
/// ];
/// let histogram = Histogram::new(custom_buckets.into_iter());
/// histogram.observe(4.2);
/// ```
// TODO: Consider using atomics. See
Expand Down

0 comments on commit 69e6674

Please sign in to comment.