devela::_dep::pyo3::types

Trait PyFrozenSetMethods

pub trait PyFrozenSetMethods<'py>: Sealed {
    // Required methods
    fn len(&self) -> usize ;
    fn contains<K>(&self, key: K) -> Result<bool, PyErr> 
       where K: IntoPyObject<'py>;
    fn iter(&self) -> BoundFrozenSetIterator<'py> ;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Available on crate features dep_pyo3 and std only.
Expand description

Implementation of functionality for PyFrozenSet.

These methods are defined for the Bound<'py, PyFrozenSet> 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§

fn len(&self) -> usize

Returns the number of items in the set.

This is equivalent to the Python expression len(self).

fn contains<K>(&self, key: K) -> Result<bool, PyErr>
where K: IntoPyObject<'py>,

Determines if the set contains the specified key.

This is equivalent to the Python expression key in self.

fn iter(&self) -> BoundFrozenSetIterator<'py>

Returns an iterator of values in this set.

Provided Methods§

fn is_empty(&self) -> bool

Checks if set is empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<'py> PyFrozenSetMethods<'py> for Bound<'py, PyFrozenSet>