Skip to main content

attr_get_or_bind

Function attr_get_or_bind 

Source
pub fn attr_get_or_bind(
    obj: &Value,
    name: &str,
    class_has_method: &dyn Fn(u32, &str) -> bool,
) -> DogeResult
Expand description

Read obj.name as a value, binding a method when there is no field of that name — the semantics of such f = a.speak. A field always wins over a method (fields appear on assignment). For a many instance, class_has_method tells whether the receiver’s class (or an ancestor) defines name; for a List/Dict, has_builtin_method decides. A name that is neither a field nor a method is the same catchable error a bare attr_get would raise.