Struct pyo3::PyDict[][src]

pub struct PyDict(_);

Represents a Python dict.

Methods

impl PyDict
[src]

Creates a new empty dictionary.

May panic when running out of memory.

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

Empty an existing dictionary of all key-value pairs.

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

Check if dict is empty.

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

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

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

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

List of dict keys. This is equivalent to the python expression list(dict.keys()).

List of dict values. This is equivalent to the python expression list(dict.values()).

List of dict items. This is equivalent to the python expression list(dict.items()).

Returns a iterator of (key, value) pairs in this dictionary Note that it's unsafe to use when the dictionary might be changed by other python code.

Trait Implementations

impl<'a> From<&'a PyDict> for &'a PyObjectRef
[src]

Performs the conversion.

impl AsRef<PyObjectRef> for PyDict
[src]

Performs the conversion.

impl PyObjectWithToken for PyDict
[src]

impl ToPyPointer for PyDict
[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl PartialEq for PyDict
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PyTypeInfo for PyDict
[src]

Type of objects to store in PyObject struct

Base class

NAME: &'static str = "PyDict"

Class name

SIZE: usize = ::std::mem::size_of::<::ffi::PyObject>()

Size of the rust PyObject structure (PyObject + rust structure)

OFFSET: isize = 0

Type instance offset inside PyObject structure

PyTypeObject instance for this type

Check if *mut ffi::PyObject is instance of this type

DESCRIPTION: &'static str = "\u{0}"

Class doc string

FLAGS: usize = 0

Type flags (ie PY_TYPE_FLAG_GC, PY_TYPE_FLAG_WEAKREF)

Check if *mut ffi::PyObject is exact instance of this type

impl PyTypeObject for PyDict
[src]

Initialize type object

Retrieves the type object for this Python object type.

Create PyRawObject which can be initialized with rust value

impl ToPyObject for PyDict
[src]

Converts self into a Python object.

impl ToBorrowedObject for PyDict
[src]

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

impl Debug for PyDict
[src]

Formats the value using the given formatter. Read more

impl Display for PyDict
[src]

Formats the value using the given formatter. Read more

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

Extracts Self from the source PyObject.

impl<'a> IntoIterator for &'a PyDict
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<'a> IntoPyDictPointer for &'a PyDict
[src]

Converts self into a PyDict object pointer. Whether pointer owned or borrowed depends on implementation. Read more

Auto Trait Implementations

impl Send for PyDict

impl Sync for PyDict