FieldDescriptor

Trait FieldDescriptor 

Source
pub trait FieldDescriptor<T> {
    type Value: Serialize + for<'de> Deserialize<'de>;

    // Required method
    fn path(&self) -> &'static str;
}
Expand description

Trait that describes how to access a field on a struct (NEW ENHANCED API)

This trait enables direct struct field access without the need for field_accessor! macros. Use the impl_field_descriptors! macro to automatically implement for all fields.

§Example

struct TradingMetrics {
    total_volume: u64,
    trade_count: u64,
}

impl_field_descriptors!(TradingMetrics {
    total_volume: u64,
    trade_count: u64
});

// Use struct fields directly
ctx.get_field(TradingMetrics::total_volume())  // returns Option<u64>
ctx.set_field(TradingMetrics::total_volume(), 1000)
ctx.increment_field(TradingMetrics::trade_count(), 1)

Required Associated Types§

Source

type Value: Serialize + for<'de> Deserialize<'de>

The type of the field value

Required Methods§

Source

fn path(&self) -> &'static str

The path to this field (e.g., “total_volume”)

Implementors§