MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / hasattr

Method hasattr

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

Source from the content-addressed store, hash-verified

35 /// This is equivalent to the Python expression 'hasattr(self, attr_name)'.
36 #[inline]
37 fn hasattr<N>(&self, py: Python, attr_name: N) -> PyResult<bool>
38 where
39 N: ToPyObject,
40 {
41 attr_name.with_borrowed_ptr(py, |attr_name| unsafe {
42 Ok(ffi::PyObject_HasAttr(self.as_ptr(), attr_name) != 0)
43 })
44 }
45
46 /// Retrieves an attribute value.
47 /// This is equivalent to the Python expression 'self.attr_name'.

Callers

nothing calls this directly

Implementers 1

objectprotocol.rssrc/objectprotocol.rs

Calls 2

with_borrowed_ptrMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected