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.
Zip multiple keypaths on the same root and apply a closure to the tuple of values.
Returns Some(closure((v1, v2, ...))) when all keypaths succeed, else None.
EnumKp - A keypath for enum variants that supports both extraction and embedding
Leverages the existing Kp architecture where optionals are built-in via Option
Keypath for Option<RefCell<T>>: get returns Option<Ref<V>> so the caller holds the guard.
Use .get(root).as_ref().map(std::cell::Ref::deref) to get Option<&V> while the Ref is in scope.