You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: resolvers.rs
    path of file: ./repos/pavex/libs/pavexc/src/compiler
    
    the code of the file until where you have to start completion: //! Given the fully qualified path to a function (be it a constructor or a handler),
//! find the corresponding item ("resolution") in `rustdoc`'s JSON output to determine
//! its input parameters and output type.
use std::ops::Deref;
use std::sync::Arc;

use ahash::{HashMap, HashMapExt};
use anyhow::anyhow;
use guppy::PackageId;
use rustdoc_types::{GenericArg, GenericArgs, GenericParamDefKind, ItemEnum, Type};

use crate::language::{
    Callable, Generic, GenericArgument, GenericLifetimeParameter, InvocationStyle, PathType,
    ResolvedPath, ResolvedPathGenericArgument, ResolvedPathLifetime, ResolvedPathType,
    ResolvedType, Slice, Tuple, TypeReference, UnknownPath,
};
use crate::rustdoc::{CannotGetCrateData, RustdocKindExt};
use crate::rustdoc::{CrateCollection, ResolvedItem};

pub(crate) fn resolve_type(
    type_: &Type,
    // The package id where the type we are trying to process has been referenced (e.g. as an
    // input/output parameter).
    used_by_package_id: &PackageId,
    krate_collection: &CrateCollection,
    generic_bindings: &HashMap<String, ResolvedType>,
) -> Result<ResolvedType, anyhow::Error> {
    match type_ {
        Type::ResolvedPath(rustdoc_types::Path { id, args, name }) => {
            let re_exporter_crate_name = if id.0.starts_with("0:") {
                // 0 is the crate index of local types.
                None
            } else {
                // It is not guaranteed that this type will be from a direct dependency of `used_by_package_id`.
                // It might be a re-export from a transitive dependency, done by a di
    
                            // `fn path(params: Params<'_, '_>) -> Result<_, _> { ... }`
                            //
                            // Can the two elided generic lifetime parameters be set to two
                            // different values? Or must they be the same?
                            // We need to check the definition of `Params` to find out.
                            let generic_arg_defs = match &type_item.inner {
                                ItemEnum::Struct(s) => &s.generics,
                                ItemEnum::Enum(e) => &e.generics,
                                _ => unreachable!(),
                            }
                            .params
                            .iter()
                            .map(|p| p.name.trim_start_matches('\'').to_string());
                            for (arg, _) in args.iter().zip(generic_arg_defs) {
                                let generic_argument = match arg {
                                    GenericArg::Lifetime(l) => {
                                        if l == "'static" {
                                            GenericArgument::Lifetime(
                                                GenericLifetimeParameter::Static,
                                            )
                                        } else {
                                            let name = l.trim_start_matches('\'');
                                            let lifetime = if name == "_" {
                                                GenericLifetimeParameter::Named("_".into())
                                            } else {
                                                GenericLifetimeParameter::Named(name.to_owned())
                                            };
                                            GenericArgument::Lifetime(lifetime)
                                        }
                                    }
                                    GenericArg::Type(generic_type) => {
                                        if let Type::Generic(generic) = generic_type {
                                            if let Some(resolved_type) =
                                                generic_bindings.get(generic)
                                            {
                                                GenericArgument::TypeParameter(
                                                    resolved_type.to_owned(),
                                                )
                                            } else {
                                                GenericArgument::TypeParameter(
                                                    ResolvedType::Generic(Generic {
                                                        name: generic.to_owned(),
                                                    }),
                                                )
                                            }
                                        } else {
                                            GenericArgument::TypeParameter(resolve_type(
                                                generic_type,
                                                used_by_package_id,
                                                krate_collection,
                                                generic_bindings,
                                            )?)
                                        }
                                    }
                                    GenericArg::Const(_) => {
                                        return Err(anyhow!(
                                            "I don't support const generics in types yet. Sorry!"
                                        ));
                                    }
                                    GenericArg::Infer => {
                                        return Err(anyhow!("I don't support inferred generic arguments in types yet. Sorry!"));
                                    }
                                };
                                generics.push(generic_argument);
                            }
                        }