pub trait PyMappingProxyMethods<'py, 'a>: Sealed {
// Required methods
fn is_empty(&self) -> PyResult<bool>;
fn keys(&self) -> PyResult<Bound<'py, PyList>>;
fn values(&self) -> PyResult<Bound<'py, PyList>>;
fn items(&self) -> PyResult<Bound<'py, PyList>>;
fn as_mapping(&self) -> &Bound<'py, PyMapping>;
fn try_iter(&'a self) -> PyResult<BoundMappingProxyIterator<'py, 'a>>;
}
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 keys(&self) -> PyResult<Bound<'py, PyList>>
fn keys(&self) -> PyResult<Bound<'py, PyList>>
Returns a list containing all keys in the mapping.
Sourcefn values(&self) -> PyResult<Bound<'py, PyList>>
fn values(&self) -> PyResult<Bound<'py, PyList>>
Returns a list containing all values in the mapping.
Sourcefn items(&self) -> PyResult<Bound<'py, PyList>>
fn items(&self) -> PyResult<Bound<'py, PyList>>
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
.
Sourcefn try_iter(&'a self) -> PyResult<BoundMappingProxyIterator<'py, 'a>>
fn try_iter(&'a self) -> PyResult<BoundMappingProxyIterator<'py, 'a>>
Takes an object and returns an iterator for it. Returns an error if the object is not iterable.