pub trait PyMappingProxyMethods<'py, 'a>: Sealed {
// Required methods
fn is_empty(&self) -> Result<bool, PyErr>;
fn keys(&self) -> Result<Bound<'py, PyList>, PyErr>;
fn values(&self) -> Result<Bound<'py, PyList>, PyErr>;
fn items(&self) -> Result<Bound<'py, PyList>, PyErr>;
fn as_mapping(&self) -> &Bound<'py, PyMapping>;
fn try_iter(&'a self) -> Result<BoundMappingProxyIterator<'py, 'a>, PyErr>;
}
Expand description
Implementation of functionality for PyMappingProxy
.
These methods are defined for the Bound<'py, PyMappingProxy>
smart pointer, so to use method call
syntax these methods are separated into a trait, because stable Rust does not yet support
arbitrary_self_types
.
Required Methods§
Sourcefn is_empty(&self) -> Result<bool, PyErr>
fn is_empty(&self) -> Result<bool, PyErr>
Checks if the mappingproxy is empty, i.e. len(self) == 0
.
Sourcefn keys(&self) -> Result<Bound<'py, PyList>, PyErr>
fn keys(&self) -> Result<Bound<'py, PyList>, PyErr>
Returns a list containing all keys in the mapping.
Sourcefn values(&self) -> Result<Bound<'py, PyList>, PyErr>
fn values(&self) -> Result<Bound<'py, PyList>, PyErr>
Returns a list containing all values in the mapping.
Sourcefn items(&self) -> Result<Bound<'py, PyList>, PyErr>
fn items(&self) -> Result<Bound<'py, PyList>, PyErr>
Returns a list of tuples of all (key, value) pairs in the mapping.
Sourcefn as_mapping(&self) -> &Bound<'py, PyMapping>
fn as_mapping(&self) -> &Bound<'py, PyMapping>
Returns self
cast as a PyMapping
.