[−][src]Struct rustypy::pytypes::pydict::PyDict
Methods
impl<K> PyDict<K> where
K: Eq + Hash + PyDictKey,
[src]
K: Eq + Hash + PyDictKey,
pub fn new() -> PyDict<K>
[src]
Creates an empty PyDict.
pub fn insert<V>(&mut self, k: K, v: V) -> Option<V> where
PyArg: From<V>,
V: From<PyArg>,
[src]
PyArg: From<V>,
V: From<PyArg>,
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.
pub fn remove<V>(&mut self, k: &K) -> Option<V> where
V: From<PyArg>,
[src]
V: From<PyArg>,
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.
pub fn get<'a, V>(&'a self, k: &K) -> Option<&'a V> where
PyArg: AsRef<V>,
[src]
PyArg: AsRef<V>,
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.
pub unsafe fn from_ptr(ptr: *mut size_t) -> PyDict<K>
[src]
Get a PyDict from a previously boxed PyDict.
Takes the key as type parameter K
, the raw pointer to the dictionary as argument
and returns a PyDict with key type K
(check
PyArg variants for allowed key types).
let dict = unsafe { PyDict::<u64>::from_ptr(dict) };
pub fn into_raw(self) -> *mut size_t
[src]
Returns self as raw pointer. Use this method when returning a PyDict to Python.
pub fn into_hashmap<V>(self) -> HashMap<K, V> where
V: From<PyArg>,
[src]
V: From<PyArg>,
Consumes self and returns a HashMap, takes one type parameter and transforms inner content to that type.
pub fn speciallized_iter<V: From<PyArg>>(self) -> IntoIter<K, V>
[src]
Consume self and turn it into an iterator.
Trait Implementations
impl<K> AsRef<PyDict<K>> for PyArg where
K: Eq + Hash + PyDictKey,
[src]
K: Eq + Hash + PyDictKey,
impl<K: Clone> Clone for PyDict<K> where
K: Eq + Hash + PyDictKey,
[src]
K: Eq + Hash + PyDictKey,
impl<K: Debug> Debug for PyDict<K> where
K: Eq + Hash + PyDictKey,
[src]
K: Eq + Hash + PyDictKey,
impl<K: Default> Default for PyDict<K> where
K: Eq + Hash + PyDictKey,
[src]
K: Eq + Hash + PyDictKey,
impl<K, V> From<HashMap<K, V, RandomState>> for PyDict<K> where
K: PyDictKey + Eq + Hash,
PyArg: From<V>,
[src]
K: PyDictKey + Eq + Hash,
PyArg: From<V>,
impl<K> From<PyArg> for PyDict<K> where
K: Eq + Hash + PyDictKey,
[src]
K: Eq + Hash + PyDictKey,
impl<K> From<PyDict<K>> for PyArg where
K: Eq + Hash + PyDictKey,
[src]
K: Eq + Hash + PyDictKey,
impl<K, V> FromIterator<(K, V)> for PyDict<K> where
K: PyDictKey + Eq + Hash,
PyArg: From<V>,
[src]
K: PyDictKey + Eq + Hash,
PyArg: From<V>,
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
[src]
impl<K: PartialEq> PartialEq<PyDict<K>> for PyDict<K> where
K: Eq + Hash + PyDictKey,
[src]
K: Eq + Hash + PyDictKey,
impl<K> StructuralPartialEq for PyDict<K> where
K: Eq + Hash + PyDictKey,
[src]
K: Eq + Hash + PyDictKey,
Auto Trait Implementations
impl<K> RefUnwindSafe for PyDict<K> where
K: RefUnwindSafe,
K: RefUnwindSafe,
impl<K> !Send for PyDict<K>
impl<K> !Sync for PyDict<K>
impl<K> Unpin for PyDict<K> where
K: Unpin,
K: Unpin,
impl<K> UnwindSafe for PyDict<K> where
K: UnwindSafe,
K: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,