MCPcopy Index your code
hub / github.com/RustPython/RustPython / from_iter

Method from_iter

crates/vm/src/builtins/set.rs:95–108  ·  view source on GitHub ↗

Also used by ssl.rs windows.

(
        vm: &VirtualMachine,
        it: impl IntoIterator<Item = PyObjectRef>,
    )

Source from the content-addressed store, hash-verified

93impl PyFrozenSet {
94 // Also used by ssl.rs windows.
95 pub fn from_iter(
96 vm: &VirtualMachine,
97 it: impl IntoIterator<Item = PyObjectRef>,
98 ) -> PyResult<Self> {
99 let inner = PySetInner::default();
100 for elem in it {
101 inner.add(elem, vm)?;
102 }
103 // FIXME: empty set check
104 Ok(Self {
105 inner,
106 ..Default::default()
107 })
108 }
109
110 pub fn elements(&self) -> Vec<PyObjectRef> {
111 self.inner.elements()

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected