'Returns a string for the function prototype of the routine.
If the routine has multiple result objects, an CodeGenError is
raised.
See: http://en.wikipedia.org/wiki/Function_prototype'

def get_prototype(self, routine):

    results = [i.get_datatype('Rust') for i in routine.results]
    if (len(results) == 1):
        rstype = ('    ->    ' + results[0])
    elif (len(routine.results) > 1):
        rstype = (('    ->    (' + ',    '.join(results)) + ')')
    else:
        rstype = ''
    type_args = []
    for arg in routine.arguments:
        name = self.printer.doprint(arg.name)
        if (arg.dimensions or isinstance(arg, ResultBase)):
            type_args.append((('*%s' % name), arg.get_datatype('Rust')))
        else:
            type_args.append((name, arg.get_datatype('Rust')))
    arguments = ',    '.join([('%s:    %s' % t) for t in type_args])
    return ('fn    %s(%s)%s' % (routine.name, arguments, rstype))
