Skip to content

Conversation

@usbalbin
Copy link
Owner

@usbalbin usbalbin commented Oct 5, 2025

I think something like this should allow having more complex types as metrics. Not quite sure if Metric with its set/get is still appropriate for interacting with these more complex structures. Either way...

This allows deriving the Metricable trait for user structs which are in turn composed of only Metricable fields.

The type information is stored in a symbol which the tool can pick up and add to its lookup table. When the tool then sees a metric it would simply look up the type in the lookup table and generate a set of "primitive metrics" from that more complex type.

TODO:

  • derive macro
  • Update the tool to understand custom types
  • arrays...
  • Figure out how to use it from the target side - Metric or something else?
  • Update/add examples
  • Make the code pretty

@usbalbin
Copy link
Owner Author

usbalbin commented Oct 5, 2025

Another thought, what about something like this?

#[derive(Plottable)]
struct Foo {
    #[metric("bar / 33.1")]
    bar: u8,

    baz: Baz,

    #[setting(0..=3, 1)]
    quix: f32
}

#[derive(Plottable)]
struct Baz {
    #[metric("a * 3.0")]
    a: i16
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants