pub struct PySet(_);
Expand description

Represents a Python set.

Implementations

Creates a new set from any iterable

Corresponds to set(iterable) in Python.

Creates an empty set

Corresponds to set() in Python

Empty an existing set of all values.

Return the number of items in the set This is equivalent to Python len(self)

Determine if the set contains the specified value. This is equivalent to the Python expression value in self.

Add a value. This is equivalent to the Python expression self.add(value).

Discard a value This is equivalent to the Python expression self.discard(value).

Pop a value This is equivalent to the Python expression self.pop(value). We get KeyError if the set is empty

Trait Implementations

Extracts Self from the source PyObject.
Extracts Self from the source PyObject.

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

Casts the Python object to PyObject.
Casts the Python object to PyObject.
Cast from PyObject to a concrete Python object type.
Cast from PyObject to a concrete Python object type.
Retrieves the type object for this Python object type.

Identity conversion: allows using existing PyObject instances where T: ToPyObject is expected.

Converts self into a Python object.
Converts self into a Python object. Read more
Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.