Struct pyo3::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]

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

[src]

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

[src]

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

[src]

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 AsRef<PyObjectRef> for PyDict
[src]

[src]

Performs the conversion.

impl PyObjectWithToken for PyDict
[src]

[src]

impl ToPyPointer for PyDict
[src]

[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl PartialEq for PyDict
[src]

[src]

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

1.0.0
[src]

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

[src]

PyTypeObject instance for this type

[src]

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)

[src]

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

impl PyTypeObject for PyDict
[src]

[src]

Initialize type object

[src]

Retrieves the type object for this Python object type.

[src]

Create PyRawObject which can be initialized with rust value

impl ToPyObject for PyDict
[src]

[src]

Converts self into a Python object.

impl ToBorrowedObject for PyDict
[src]

[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]

[src]

Formats the value using the given formatter.

impl Display for PyDict
[src]

[src]

Formats the value using the given formatter. Read more

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

[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?

[src]

Creates an iterator from a value. Read more

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

[src]

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