pub fn resolve_signature_token_with_fetcher<'txn, F: ModuleFetcher>(
        &'txn self,
        module: &LoadedModule,
        tok: &SignatureToken,
        type_context: &TypeContext,
        gas_meter: &GasMeter,
        fetcher: &F,
    ) -> VMResult<Option<Type>> {
        match tok {
            SignatureToken::Bool => Ok(Some(Type::Bool)),
            SignatureToken::U64 => Ok(Some(Type::U64)),
            SignatureToken::String => Ok(Some(Type::String)),
            SignatureToken::ByteArray => Ok(Some(Type::ByteArray)),
            SignatureToken::Address => Ok(Some(Type::Address)),
            SignatureToken::TypeParameter(idx) => Ok(Some(type_context.get_type(*idx)?)),
            SignatureToken::Struct(sh_idx, tys) => {
                let ctx = {
                    let mut ctx = vec![];
                    for ty in tys.iter() {
                        let resolved_type = self.resolve_signature_token_with_fetcher(
                            module,
                            ty,
                            type_context,
                            gas_meter,
                            fetcher,
                        )?;
                        if let Some(t) = resolved_type {
                            ctx.push(t);
                        } else {
                            return Ok(None);
                        }
                    }
                    TypeContext::new(ctx)
                };
                let struct_def = self
                    .resolve_struct_handle_with_fetcher(module, *sh_idx, gas_meter, fetcher)?
                    .map(|def| ctx.subst_struct_def(&def))
                    .transpose()?;
                Ok(struct_def.map(Type::Struct))
            }
            SignatureToken::Reference(sub_tok) => {
                let inner_ty = self.resolve_signature_token_with_fetcher(
                    module,
                    sub_tok,
                    type_context,
                    gas_meter,
                    fetcher,
                )?;
                Ok(inner_ty.map(|t| Type::Reference(Box::new(t))))
            }
            SignatureToken::MutableReference(sub_tok) => {
                let inner_ty = self.resolve_signature_token_with_fetcher(
                    module,
                    sub_tok,
                    type_context,
                    gas_meter,
                    fetcher,
                )?;
                Ok(inner_ty.map(|t| Type::MutableReference(Box::new(t))))
            }
        }
    }
/// Resolve a SignatureToken into a Type recursively in either the cache or the `fetcher`.
Resolve a SignatureToken into a Type recursively in either the cache or the `fetcher`.
Resolve a SignatureToken into a Type recursively in either the cache or the ` fetcher ` .
pub fn resolve_signature_token_with_fetcher<'txn, F: ModuleFetcher>(
        &'txn self,
        module: &LoadedModule,
        tok: &SignatureToken,
        type_context: &TypeContext,
        gas_meter: &GasMeter,
        fetcher: &F,
    ) -> VMResult<Option<Type>> {
        match tok {
            SignatureToken::Bool => Ok(Some(Type::Bool)),
            SignatureToken::U64 => Ok(Some(Type::U64)),
            SignatureToken::String => Ok(Some(Type::String)),
            SignatureToken::ByteArray => Ok(Some(Type::ByteArray)),
            SignatureToken::Address => Ok(Some(Type::Address)),
            SignatureToken::TypeParameter(idx) => Ok(Some(type_context.get_type(*idx)?)),
            SignatureToken::Struct(sh_idx, tys) => {
                let ctx = {
                    let mut ctx = vec![];
                    for ty in tys.iter() {
                        let resolved_type = self.resolve_signature_token_with_fetcher(
                            module,
                            ty,
                            type_context,
                            gas_meter,
                            fetcher,
                        )?;
                        if let Some(t) = resolved_type {
                            ctx.push(t);
                        } else {
                            return Ok(None);
                        }
                    }
                    TypeContext::new(ctx)
                };
                let struct_def = self
                    .resolve_struct_handle_with_fetcher(module, *sh_idx, gas_meter, fetcher)?
                    .map(|def| ctx.subst_struct_def(&def))
                    .transpose()?;
                Ok(struct_def.map(Type::Struct))
            }
            SignatureToken::Reference(sub_tok) => {
                let inner_ty = self.resolve_signature_token_with_fetcher(
                    module,
                    sub_tok,
                    type_context,
                    gas_meter,
                    fetcher,
                )?;
                Ok(inner_ty.map(|t| Type::Reference(Box::new(t))))
            }
            SignatureToken::MutableReference(sub_tok) => {
                let inner_ty = self.resolve_signature_token_with_fetcher(
                    module,
                    sub_tok,
                    type_context,
                    gas_meter,
                    fetcher,
                )?;
                Ok(inner_ty.map(|t| Type::MutableReference(Box::new(t))))
            }
        }
    }
pub fn resolve_signature_token_with_fetcher < ' txn , F : ModuleFetcher > ( & ' txn self , module : & LoadedModule , tok : & SignatureToken , type_context : & TypeContext , gas_meter : & GasMeter , fetcher : & F , ) -> VMResult < Option < Type > > { match tok { SignatureToken :: Bool => Ok ( Some ( Type :: Bool ) ) , SignatureToken :: U64 => Ok ( Some ( Type :: U64 ) ) , SignatureToken :: String => Ok ( Some ( Type :: String ) ) , SignatureToken :: ByteArray => Ok ( Some ( Type :: ByteArray ) ) , SignatureToken :: Address => Ok ( Some ( Type :: Address ) ) , SignatureToken :: TypeParameter ( idx ) => Ok ( Some ( type_context . get_type ( * idx ) ? ) ) , SignatureToken :: Struct ( sh_idx , tys ) => { let ctx = { let mut ctx = vec ! [ ] ; for ty in tys . iter ( ) { let resolved_type = self . resolve_signature_token_with_fetcher ( module , ty , type_context , gas_meter , fetcher , ) ? ; if let Some ( t ) = resolved_type { ctx . push ( t ) ; } else { return Ok ( None ) ; } } TypeContext :: new ( ctx ) } ; let struct_def = self . resolve_struct_handle_with_fetcher ( module , * sh_idx , gas_meter , fetcher ) ? . map ( | def | ctx . subst_struct_def ( & def ) ) . transpose ( ) ? ; Ok ( struct_def . map ( Type :: Struct ) ) } SignatureToken :: Reference ( sub_tok ) => { let inner_ty = self . resolve_signature_token_with_fetcher ( module , sub_tok , type_context , gas_meter , fetcher , ) ? ; Ok ( inner_ty . map ( | t | Type :: Reference ( Box :: new ( t ) ) ) ) } SignatureToken :: MutableReference ( sub_tok ) => { let inner_ty = self . resolve_signature_token_with_fetcher ( module , sub_tok , type_context , gas_meter , fetcher , ) ? ; Ok ( inner_ty . map ( | t | Type :: MutableReference ( Box :: new ( t ) ) ) ) } } }
Resolve a SignatureToken into a Type recursively in either the cache or the `fetcher`.
Resolve a SignatureToken into a Type recursively in either the cache or the ` fetcher ` .
&'txn self
module
&LoadedModule
tok
&SignatureToken
type_context
&TypeContext
gas_meter
&GasMeter
fetcher
&F