FieldAccessor

Trait FieldAccessor 

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

    // Required method
    fn path() -> &'static str;

    // Provided method
    fn segments() -> Vec<&'static str> { ... }
}
Expand description

Trait for type-safe field access without string literals (LEGACY API)

Implement this trait to create compile-time checked field accessors:

struct TotalVolume;
impl FieldAccessor for TotalVolume {
    type Value = u64;
    fn path() -> &'static str { "total_volume" }
}

Or use the field_accessor! macro for convenience.

DEPRECATED: Consider using the new field! macro instead for cleaner syntax.

Required Associated Types§

Source

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

The type of the field value

Required Methods§

Source

fn path() -> &'static str

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

Provided Methods§

Source

fn segments() -> Vec<&'static str>

The nested path segments if needed (auto-computed from path)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§