MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / new

Method new

src/objects/set.rs:36–43  ·  view source on GitHub ↗

Creates a new set from any iterable Corresponds to `set(iterable)` in Python.

(py: Python, iterable: I)

Source from the content-addressed store, hash-verified

34 ///
35 /// Corresponds to `set(iterable)` in Python.
36 pub fn new<I>(py: Python, iterable: I) -> PyResult<PySet>
37 where
38 I: ToPyObject,
39 {
40 iterable.with_borrowed_ptr(py, |iterable| unsafe {
41 err::result_cast_from_owned_ptr(py, ffi::PySet_New(iterable))
42 })
43 }
44
45 /// Creates an empty set
46 ///

Callers

nothing calls this directly

Calls 2

with_borrowed_ptrMethod · 0.45

Tested by

no test coverage detected