macro_rules! field_accessor {
($name:ident, $type:ty, $path:expr) => { ... };
}Expand description
Macro to define type-safe field accessors (LEGACY API)
§Examples
ⓘ
// Simple field accessor
field_accessor!(TotalVolume, u64, "total_volume");
// Nested field accessor
field_accessor!(LastPrice, f64, "reserves.last_price");
// Usage with MetricsContext
ctx.get_field(TotalVolume) // returns Option<u64>
ctx.set_field(TotalVolume, 1000)DEPRECATED: Consider using the new field! macro instead:
ⓘ
ctx.get(&field!(entity, total_volume)) // Cleaner, no accessor struct needed
ctx.set(&field!(entity, total_volume), 1000)