[][src]Struct pyo3::types::PyDict

#[repr(transparent)]
pub struct PyDict(_);

Represents a Python dict.

Methods

impl PyDict
[src]

Creates a new empty dictionary.

Creates a new dictionary from the sequence given.

The sequence must consist of (PyObject, PyObject). This is equivalent to dict([("a", 1), ("b", 2)]).

Returns an error on invalid input. In the case of key collisions, this keeps the last entry seen.

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

impl PyObjectWithGIL for PyDict
[src]

impl ToPyPointer for PyDict
[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl PyTypeInfo for PyDict
[src]

Type of objects to store in PyObject struct

Base class

Class doc string

Type flags (ie PY_TYPE_FLAG_GC, PY_TYPE_FLAG_WEAKREF)

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

impl PyObjectAlloc for PyDict
[src]

Calls the rust destructor for the object and frees the memory (usually by calling ptr->ob_type->tp_free). This function is used as tp_dealloc implementation. Read more

Calls the rust destructor for the object.

impl PyTypeCreate for PyDict
[src]

Create PyRawObject which can be initialized with rust value

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

impl AsRef<PyObjectRef> for PyDict
[src]

impl PartialEq<PyDict> for PyDict
[src]

This method tests for !=.

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

impl Display for PyDict
[src]

impl Debug for PyDict
[src]

Auto Trait Implementations

impl Send for PyDict

impl Sync for PyDict

Blanket Implementations

impl<T> PyObjectAlloc for T where
    T: PyObjectWithFreeList
[src]

Calls the rust destructor for the object.

impl<T> PyTypeObject for T where
    T: PyTypeCreate
[src]

impl<T> PyTypeCreate for T where
    T: PyObjectAlloc + PyTypeInfo
[src]

Create PyRawObject which can be initialized with rust value

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]