Skip to main content

LineProtocolTag

Derive Macro LineProtocolTag 

Source
#[derive(LineProtocolTag)]
{
    // Attributes available to this derive:
    #[line_protocol]
}
Expand description

Derive macro for LineProtocolTag.

§Enum Type

This macro supports enum type. It may have fields, but they are ignored.

  • #[line_protocol(case = "...")] may be used to automatically rename the all variants.
    • The possible choices is currently kebab (default), pascal or snake.
  • #[line_protocol(rename = "...")] may be used to rename individual variants.

§Example

use line_protocol::LineProtocolTag;

#[derive(LineProtocolTag)]
#[line_protocol(case = "kebab")]
enum Station {
    PowerStation1,
    PowerStation2,
    PowerStation3,
    #[line_protocol(rename = "thermal-station-1")]
    ThermalChamber1,
    #[line_protocol(rename = "thermal-station-2")]
    ThermalChamber2,
}