MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / all_instances_of

Method all_instances_of

crates/rustc_codegen_spirv/src/linker/specializer.rs:2250–2260  ·  view source on GitHub ↗

Return the subset of `instances` that have `generic_id`. This is efficiently implemented via `BTreeMap::range`, taking advantage of the derived `Ord` on `Instance`, which orders by `generic_id` first, resulting in `instances` being grouped by `generic_id`.

(
        &self,
        generic_id: Word,
    )

Source from the content-addressed store, hash-verified

2248 /// of the derived `Ord` on `Instance`, which orders by `generic_id` first,
2249 /// resulting in `instances` being grouped by `generic_id`.
2250 fn all_instances_of(
2251 &self,
2252 generic_id: Word,
2253 ) -> std::collections::btree_map::Range<'_, Instance<SmallVec<[CopyOperand; 4]>>, Word> {
2254 let first_instance_of = |generic_id| Instance {
2255 generic_id,
2256 generic_args: SmallVec::new(),
2257 };
2258 self.instances
2259 .range(first_instance_of(generic_id)..first_instance_of(generic_id + 1))
2260 }
2261
2262 /// Allocate a new ID for `instance`, or return a cached one if it exists.
2263 /// If a new ID is created, `instance` is added to `propagate_instances_queue`,

Callers 2

expand_moduleMethod · 0.80
dump_instancesMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected