pub fn get<Root, Value>(keypath: KeyPath<Root, Value>) -> impl Fn(Root) -> Valuewhere
Value: Clone + 'static,Expand description
Produces a getter function for a given key path. Useful for composing property access with functions. Equivalent to Swift’s get<Root, Value>(_ keyPath: KeyPath<Root, Value>) -> (Root) -> Value
§Examples
use overture_core::keypath::{KeyPath, get};
let name_keypath = KeyPath::new(|person: &Person| person.name.clone());
let get_name = get(name_keypath);
let person = Person { name: "Alice".to_string(), age: 30 };
assert_eq!(get_name(person), "Alice");