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: sig_registry.rs
    path of file: ./repos/nearcore/runtime/near-vm/vm/src
    
    the code of the file until where you have to start completion: // This file contains code from external sources.
// Attributions: https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md

//! Implement a registry of function signatures, for fast indirect call
//! signature checking.

use near_vm_types::FunctionType;
use std::collections::{hash_map, HashMap};
use std::convert::TryFrom;

/// An index into the shared signature registry, usable for checking signatures
/// 
    
    pub fn register(&mut self, sig: FunctionType) -> VMSharedSignatureIndex {
        let len = self.index_to_data.len();
        // TODO(0-copy): this. should. not. allocate. (and take FunctionTypeRef as a parameter)
        //
        // This is pretty hard to avoid, however. In order to implement bijective map, we'd want
        // a `Rc<FunctionType>`, but indexing into a map keyed by `Rc<FunctionType>` with
        // `FunctionTypeRef` is… not possible given the current API either.
        //
        // Consider `transmute` or `hashbrown`'s raw_entry.
        match self.type_to_index.entry(sig.clone()) {
            hash_map::Entry::Occupied(entry) => *entry.get(),
            hash_map::Entry::Vacant(entry) => {
                debug_assert!(
                    u32::try_from(len).is_ok(),
                    "invariant: can't have more than 2³²-1 signatures!"
                );
                let sig_id = VMSharedSignatureIndex::new(u32::try_from(len).unwrap());
                entry.insert(sig_id);
                self.index_to_data.push(sig);
                sig_id
            }
        }
    }