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

Method intersection

crates/vm/src/builtins/set.rs:255–264  ·  view source on GitHub ↗
(&self, other: ArgIterable, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

253 }
254
255 pub(super) fn intersection(&self, other: ArgIterable, vm: &VirtualMachine) -> PyResult<Self> {
256 let set = Self::default();
257 for item in other.iter(vm)? {
258 let obj = item?;
259 if self.contains(&obj, vm)? {
260 set.add(obj, vm)?;
261 }
262 }
263 Ok(set)
264 }
265
266 pub(super) fn difference(&self, other: ArgIterable, vm: &VirtualMachine) -> PyResult<Self> {
267 let set = self.copy();

Callers 2

__and__Method · 0.45
set_inner_number_andFunction · 0.45

Calls 5

fold_opMethod · 0.80
iterMethod · 0.45
containsMethod · 0.45
addMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected