Struct cpython::PyDict [] [src]

pub struct PyDict(_);

Represents a Python dict.

Methods

impl PyDict
[src]

[src]

Creates a new empty dictionary.

May panic when running out of memory.

[src]

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

[src]

Empty an existing dictionary of all key-value pairs.

[src]

Return the number of items in the dictionary. This is equivalent to len(p) on a dictionary.

[src]

Determine if the dictionary contains the specified key. This is equivalent to the Python expression key in self.

[src]

Gets an item from the dictionary. Returns None if the item is not present, or if an error occurs.

[src]

Sets an item value. This is equivalent to the Python expression self[key] = value.

[src]

Deletes an item. This is equivalent to the Python expression del self[key].

[src]

[src]

Returns the list of (key,value) pairs in this dictionary.

Trait Implementations

impl ToPyObject for PyDict
[src]

Identity conversion: allows using existing PyObject instances where T: ToPyObject is expected.

[src]

Converts self into a Python object.

[src]

Converts self into a Python object. Read more

[src]

Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more

impl<'source> FromPyObject<'source> for PyDict
[src]

[src]

Extracts Self from the source PyObject.

impl<'source> FromPyObject<'source> for &'source PyDict
[src]

[src]

Extracts Self from the source PyObject.

impl PythonObject for PyDict
[src]

[src]

Casts the Python object to PyObject.

[src]

Casts the Python object to PyObject.

[src]

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

[src]

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

impl PythonObjectWithCheckedDowncast for PyDict
[src]

[src]

Cast from PyObject to a concrete Python object type.

[src]

Cast from PyObject to a concrete Python object type.

impl PythonObjectWithTypeObject for PyDict
[src]

[src]

Retrieves the type object for this Python object type.