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

Function iter_use_idents

crates/derive-impl/src/util.rs:682–698  ·  view source on GitHub ↗
(item_use: &'a syn::ItemUse, mut f: F)

Source from the content-addressed store, hash-verified

680}
681
682pub(crate) fn iter_use_idents<'a, F, R: 'a>(item_use: &'a syn::ItemUse, mut f: F) -> Result<Vec<R>>
683where
684 F: FnMut(&'a syn::Ident, bool) -> Result<R>,
685{
686 let mut result = Vec::new();
687 match &item_use.tree {
688 UseTree::Name(name) => result.push(f(&name.ident, true)?),
689 UseTree::Rename(rename) => result.push(f(&rename.rename, true)?),
690 UseTree::Path(path) => match &*path.tree {
691 UseTree::Name(name) => result.push(f(&name.ident, true)?),
692 UseTree::Rename(rename) => result.push(f(&rename.rename, true)?),
693 other => iter_use_tree_idents(other, &mut result, &mut f)?,
694 },
695 other => iter_use_tree_idents(other, &mut result, &mut f)?,
696 }
697 Ok(result)
698}
699
700fn iter_use_tree_idents<'a, F, R: 'a>(
701 tree: &'a syn::UseTree,

Callers 2

pyclass_ident_and_attrsFunction · 0.85
gen_module_itemMethod · 0.85

Calls 4

newFunction · 0.85
iter_use_tree_identsFunction · 0.85
fFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected