pub struct PyDict(/* private fields */);
Expand description
Represents a Python dict
.
Values of this type are accessed via PyO3’s smart pointers, e.g. as
Py<PyDict>
or Bound<'py, PyDict>
.
For APIs available on dict
objects, see the PyDictMethods
trait which is implemented for
Bound<'py, PyDict>
.
Implementations§
Source§impl PyDict
impl PyDict
Sourcepub fn from_sequence_bound<'py>(
seq: &Bound<'py, PyAny>,
) -> PyResult<Bound<'py, PyDict>>
pub fn from_sequence_bound<'py>( seq: &Bound<'py, PyAny>, ) -> PyResult<Bound<'py, PyDict>>
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.
Trait Implementations§
Source§impl AsPyPointer for PyDict
impl AsPyPointer for PyDict
Source§impl PyTypeInfo for PyDict
impl PyTypeInfo for PyDict
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
Source§fn is_type_of_bound(obj: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(obj: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type or a subclass of this type.impl DerefToPyAny for PyDict
impl PyLayout<PyDict> for PyDictObject
impl PySizedLayout<PyDict> for PyDictObject
Auto Trait Implementations§
impl !Freeze for PyDict
impl !RefUnwindSafe for PyDict
impl !Send for PyDict
impl !Sync for PyDict
impl Unpin for PyDict
impl UnwindSafe for PyDict
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more