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

Method set_item

src/objectprotocol.rs:303–313  ·  view source on GitHub ↗
(&self, py: Python, key: K, value: V)

Source from the content-addressed store, hash-verified

301 /// This is equivalent to the Python expression 'self[key] = value'.
302 #[inline]
303 fn set_item<K, V>(&self, py: Python, key: K, value: V) -> PyResult<()>
304 where
305 K: ToPyObject,
306 V: ToPyObject,
307 {
308 key.with_borrowed_ptr(py, move |key| {
309 value.with_borrowed_ptr(py, |value| unsafe {
310 err::error_on_minusone(py, ffi::PyObject_SetItem(self.as_ptr(), key, value))
311 })
312 })
313 }
314
315 /// Deletes an item.
316 /// This is equivalent to the Python expression 'del self[key]'.

Callers

nothing calls this directly

Implementers 1

objectprotocol.rssrc/objectprotocol.rs

Calls 3

error_on_minusoneFunction · 0.85
with_borrowed_ptrMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected