Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/macros: Have labels! accept any type that implements Display #350

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 3, 2020

  1. src/macros: Have labels! accept any type that implements Display

    This allows (among other things) `histogram_opts!` to take the same kinds of
    types as `opts!`. E.g. to replace this:
    
    ```rust
    let status = String::from("200");
    histogram_opts!(
        ...
        labels! {"status".to_string() => status.clone()}
    )
    // Do more stuff with `status`.
    ```
    
    with this:
    
    ```rust
    let status = String::from("200");
    histogram_opts!(
        ...
        labels! {"status" => &status}
    )
    // Do more stuff with `status`.
    ```
    
    And a lot more, such as using numbers or enums as label values directly.
    
    Signed-off-by: Alin Sinpalean <alin.sinpalean@gmail.com>
    free committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    a722af4 View commit details
    Browse the repository at this point in the history