Skip to main content

ShapeType

Derive Macro ShapeType 

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

Derive macro for Shape type metadata.

Extracts property metadata from struct fields and generates a TYPE_METADATA_<NAME> constant.

§Usage

/// A single price bar (OHLCV data)
#[derive(ShapeType)]
#[shape(name = "Candle")]
pub struct CandleValue {
    /// Opening price
    pub open: f64,
    /// Highest price
    pub high: f64,
    /// Closing price
    pub close: f64,
}