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

Method get_item

src/objectprotocol.rs:291–298  ·  view source on GitHub ↗
(&self, py: Python, key: K)

Source from the content-addressed store, hash-verified

289 /// This is equivalent to the Python expression: 'self[key]'
290 #[inline]
291 fn get_item<K>(&self, py: Python, key: K) -> PyResult<PyObject>
292 where
293 K: ToPyObject,
294 {
295 key.with_borrowed_ptr(py, |key| unsafe {
296 err::result_from_owned_ptr(py, ffi::PyObject_GetItem(self.as_ptr(), key))
297 })
298 }
299
300 /// Sets an item value.
301 /// This is equivalent to the Python expression 'self[key] = value'.

Callers

nothing calls this directly

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