Skip to content

Make Metric::measurement_name() not take &self, if possible #2264

@theodorebugnet

Description

@theodorebugnet

Consider

pub struct MetricBatch<M: Metric> {
    pub metrics: Vec<M>,
}

impl<M: Metric> Metric for MetricBatch<M> {
    fn measurement_name(&self) -> &'static str {
        // What here?
    }
    //...
}

In practice since the method returns &'static str, it effectively never depends on &self. If the function is refactored to not take self, then the batch implementation could simply call M::measurement_name().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions