Struct rustypy::pytypes::pydict::PyDict [] [src]

pub struct PyDict<K> where
    K: Eq + Hash + PyDictKey, 
{ /* fields omitted */ }

Methods

impl<K> PyDict<K> where
    K: Eq + Hash + PyDictKey, 
[src]

Creates an empty PyDict.

Inserts a key-value pair into the map.

If the map did not have this key present, None is returned.

If the map did have this key present, the value is updated, and the old value is returned. The key is not updated, though; this matters for types that can be == without being identical. See the module-level documentation for more.

Removes a key from the map, returning the value at the key if the key was previously in the map.

The key may be any borrowed form of the map's key type, but Hash and Eq on the borrowed form must match those for the key type.

Returns a reference to the value corresponding to the key.

The key may be any borrowed form of the map's key type, but Hash and Eq on the borrowed form must match those for the key type.

Get a PyDict from a previously boxed PyDict.

Takes two type parameters: - one corresponding to the key type (check PyArg variants) - and PyArg, corresponding to the value type

And a PyDict as a raw *mut size_t pointer.

let dict = unsafe { PyDict::<u64>::from_ptr(dict) };

Returns self as raw pointer. Use this method when returning a PyTuple to Python.

Consumes self and returns a HashMap, takes one type parameter and transforms inner content to that type.

Consume self and turn it into an iterator.

Trait Implementations

impl<K: Clone> Clone for PyDict<K> where
    K: Eq + Hash + PyDictKey, 
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<K: Debug> Debug for PyDict<K> where
    K: Eq + Hash + PyDictKey, 
[src]

Formats the value using the given formatter.

impl<K: PartialEq> PartialEq for PyDict<K> where
    K: Eq + Hash + PyDictKey, 
[src]

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

This method tests for !=.

impl<K, V> FromIterator<(K, V)> for PyDict<K> where
    K: PyDictKey + Eq + Hash,
    PyArg: From<V>, 
[src]

Creates a value from an iterator. Read more

impl<K, V> From<HashMap<K, V>> for PyDict<K> where
    K: PyDictKey + Eq + Hash,
    PyArg: From<V>, 
[src]

Performs the conversion.

impl<K> From<PyArg> for PyDict<K> where
    K: Eq + Hash + PyDictKey, 
[src]

Performs the conversion.