MCPcopy Index your code
hub / github.com/dgrunwald/rust-cpython / getattr

Method getattr

src/objectprotocol.rs:49–56  ·  view source on GitHub ↗
(&self, py: Python, attr_name: N)

Source from the content-addressed store, hash-verified

47 /// This is equivalent to the Python expression 'self.attr_name'.
48 #[inline]
49 fn getattr<N>(&self, py: Python, attr_name: N) -> PyResult<PyObject>
50 where
51 N: ToPyObject,
52 {
53 attr_name.with_borrowed_ptr(py, |attr_name| unsafe {
54 err::result_from_owned_ptr(py, ffi::PyObject_GetAttr(self.as_ptr(), attr_name))
55 })
56 }
57
58 /// Sets an attribute value.
59 /// This is equivalent to the Python expression 'self.attr_name = value'.

Callers 3

call_methodMethod · 0.80
getMethod · 0.80
callMethod · 0.80

Implementers 1

objectprotocol.rssrc/objectprotocol.rs

Calls 3

result_from_owned_ptrFunction · 0.85
with_borrowed_ptrMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected