pub fn visit_file_defs(
    sema: &Semantics<RootDatabase>,
    file_id: FileId,
    cb: &mut dyn FnMut(Either<hir::ModuleDef, hir::Impl>),
) {
    let db = sema.db;
    let module = match sema.to_module_def(file_id) {
        Some(it) => it,
        None => return,
    };
    let mut defs: VecDeque<_> = module.declarations(db).into();
    while let Some(def) = defs.pop_front() {
        if let ModuleDef::Module(submodule) = def {
            if let hir::ModuleSource::Module(_) = submodule.definition_source(db).value {
                defs.extend(submodule.declarations(db));
                submodule.impl_defs(db).into_iter().for_each(|impl_| cb(Either::Right(impl_)));
            }
        }
        cb(Either::Left(def));
    }
    module.impl_defs(db).into_iter().for_each(|impl_| cb(Either::Right(impl_)));
}
/// Iterates all `ModuleDef`s and `Impl` blocks of the given file.
Iterates all `ModuleDef`s and `Impl` blocks of the given file.
Iterates all ` ModuleDef ` s and ` Impl ` blocks of the given file .
pub fn visit_file_defs(
    sema: &Semantics<RootDatabase>,
    file_id: FileId,
    cb: &mut dyn FnMut(Either<hir::ModuleDef, hir::Impl>),
) {
    let db = sema.db;
    let module = match sema.to_module_def(file_id) {
        Some(it) => it,
        None => return,
    };
    let mut defs: VecDeque<_> = module.declarations(db).into();
    while let Some(def) = defs.pop_front() {
        if let ModuleDef::Module(submodule) = def {
            if let hir::ModuleSource::Module(_) = submodule.definition_source(db).value {
                defs.extend(submodule.declarations(db));
                submodule.impl_defs(db).into_iter().for_each(|impl_| cb(Either::Right(impl_)));
            }
        }
        cb(Either::Left(def));
    }
    module.impl_defs(db).into_iter().for_each(|impl_| cb(Either::Right(impl_)));
}
pub fn visit_file_defs ( sema : & Semantics < RootDatabase > , file_id : FileId , cb : & mut dyn FnMut ( Either < hir :: ModuleDef , hir :: Impl > ) , ) { let db = sema . db ; let module = match sema . to_module_def ( file_id ) { Some ( it ) => it , None => return , } ; let mut defs : VecDeque < _ > = module . declarations ( db ) . into ( ) ; while let Some ( def ) = defs . pop_front ( ) { if let ModuleDef :: Module ( submodule ) = def { if let hir :: ModuleSource :: Module ( _ ) = submodule . definition_source ( db ) . value { defs . extend ( submodule . declarations ( db ) ) ; submodule . impl_defs ( db ) . into_iter ( ) . for_each ( | impl_ | cb ( Either :: Right ( impl_ ) ) ) ; } } cb ( Either :: Left ( def ) ) ; } module . impl_defs ( db ) . into_iter ( ) . for_each ( | impl_ | cb ( Either :: Right ( impl_ ) ) ) ; }
Iterates all `ModuleDef`s and `Impl` blocks of the given file.
Iterates all ` ModuleDef ` s and ` Impl ` blocks of the given file .
sema
&Semantics<RootDatabase>
file_id
FileId
cb
&mut dyn FnMut(Either<hir::ModuleDef, hir::Impl>)