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

Method copy

src/objects/dict.rs:42–44  ·  view source on GitHub ↗

Return a new dictionary that contains the same key-value pairs as self. Corresponds to `dict(self)` in Python.

(&self, py: Python)

Source from the content-addressed store, hash-verified

40 /// Return a new dictionary that contains the same key-value pairs as self.
41 /// Corresponds to `dict(self)` in Python.
42 pub fn copy(&self, py: Python) -> PyResult<PyDict> {
43 unsafe { err::result_cast_from_owned_ptr(py, ffi::PyDict_Copy(self.0.as_ptr())) }
44 }
45
46 /// Empty an existing dictionary of all key-value pairs.
47 #[inline]

Callers

nothing calls this directly

Calls 2

as_ptrMethod · 0.45

Tested by

no test coverage detected