Get value through a keypath or a default reference when the path returns None.
Use with KpType: get_or!(User::name(), &user, &default) where default is &T (same type as the path value). Returns &T.
Path syntax: get_or!(&user => User.name, &default).
Get value through a keypath, or compute an owned fallback when the path returns None.
Use with KpType: get_or_else!(User::name(), &user, || "default".to_string()).
Returns T (owned). The keypath’s value type must be Clone. The closure is only called when the path is None.
Path syntax: get_or_else!(&user => (User.name), || "default".to_string()) — path in parentheses.
EnumKp - A keypath for enum variants that supports both extraction and embedding
Leverages the existing Kp architecture where optionals are built-in via Option
AKp (AnyKeyPath) - Hides both Root and Value types
Most flexible keypath type for heterogeneous collections
Uses dynamic dispatch and type checking at runtime
Used so that then_async can infer V2 from AsyncKp::Value without ambiguity
(e.g. &i32 has both Borrow<i32> and Borrow<&i32>; this picks the referent).
Implemented only for reference types so there is no overlap with the blanket impl.