#[derive(Keypath)]Expand description
Derives a single keypath method for each struct field.
This macro generates a simplified set of keypath methods, creating only
the most commonly used readable keypaths. It’s a lighter-weight alternative
to Keypaths when you only need basic field access.
§Generated Methods
For each field field_name, generates:
field_name_r()- Returns aKeyPath<Struct, FieldType>for direct field access
§Examples
ⓘ
use keypaths_proc::Keypath;
#[derive(Keypath)]
struct Point {
x: f64,
y: f64,
}
// Usage:
let point = Point { x: 1.0, y: 2.0 };
let x_path = Point::x_r();
let x_value = x_path.get(&point); // &f64