MCPcopy Create free account
hub / github.com/SingleRust/SingleRust / get_select_info_vars

Function get_select_info_vars

src/shared/processing/mod.rs:26–45  ·  view source on GitHub ↗
(
    vars_mask: Option<ArrayView<'_, bool, Ix1>>,
)

Source from the content-addressed store, hash-verified

24}
25
26pub fn get_select_info_vars(
27 vars_mask: Option<ArrayView<'_, bool, Ix1>>,
28) -> anyhow::Result<Vec<SelectInfoElem>> {
29 // Convert mask to indices
30 let vars_indices = vars_mask.map(|mask| {
31 mask.iter()
32 .enumerate()
33 .filter_map(|(i, &b)| if b { Some(i) } else { None })
34 .collect::<Vec<_>>()
35 });
36
37 // Create a selection based on the mask
38 let mut selection = vec![SelectInfoElem::full(), SelectInfoElem::full()];
39 if let Some(vars_idx) = vars_indices {
40 log!(Level::Debug, "VarIDx length: {}", vars_idx.len());
41 selection[1] = SelectInfoElem::Index(vars_idx);
42 }
43
44 Ok(selection)
45}
46
47#[derive(Debug)]
48pub enum FlavorType {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected