(self, state: 'ModuleState', args: T.List, kwargs: 'FuncBindgen')
return ModuleReturnValue([target], [target])
Wrapper around bindgen to simplify it's use.

        The main thing this simplifies is the use of `include_directory`
        objects, instead of having to pass a plethora of `-I` arguments.
Wrapper around bindgen to simplify it's use.
Wrapper around bindgen to simplify it s use .
def bindgen(self, state: 'ModuleState', args: T.List, kwargs: 'FuncBindgen') -> ModuleReturnValue:
        """Wrapper around bindgen to simplify it's use.

        The main thing this simplifies is the use of `include_directory`
        objects, instead of having to pass a plethora of `-I` arguments.
        """
        header, *_deps = self.interpreter.source_strings_to_files(kwargs['input'])

        # Split File and Target dependencies to add pass to CustomTarget
        depends: T.List['SourceOutputs'] = []
        depend_files: T.List[File] = []
        for d in _deps:
            if isinstance(d, File):
                depend_files.append(d)
            else:
                depends.append(d)

        inc_strs: T.List[str] = []
        for i in kwargs['include_directories']:
            # bindgen always uses clang, so it's safe to hardcode -I here
            inc_strs.extend([f'-I{x}' for x in i.to_string_list(state.environment.get_source_dir())])

        if self._bindgen_bin is None:
            self._bindgen_bin = state.find_program('bindgen')

        name: str
        if isinstance(header, File):
            name = header.fname
        elif isinstance(header, (BuildTarget, BothLibraries, ExtractedObjects)):
            raise InterpreterException('bindgen source file must be a C header, not an object or build target')
        else:
            name = header.get_outputs()[0]

        target = CustomTarget(
            f'rustmod-bindgen-{name}'.replace('/', '_'),
            state.subdir,
            state.subproject,
            {
                'input': header,
                'output': kwargs['output'],
                'command': self._bindgen_bin.get_command() + [
                    '@INPUT@', '--output',
                    os.path.join(state.environment.build_dir, '@OUTPUT@')] +
                    kwargs['args'] + ['--'] + kwargs['c_args'] + inc_strs +
                    ['-MD', '-MQ', '@INPUT@', '-MF', '@DEPFILE@'],
                'depfile': '@PLAINNAME@.d',
                'depends': depends,
                'depend_files': depend_files,
            },
            backend=state.backend,
        )

        return ModuleReturnValue([target], [target])
def bindgen ( self , state : 'ModuleState' , args : T . List , kwargs : 'FuncBindgen' ) -> ModuleReturnValue : header , * _deps = self . interpreter . source_strings_to_files ( kwargs [ 'input' ] ) # Split File and Target dependencies to add pass to CustomTarget depends : T . List [ 'SourceOutputs' ] = [ ] depend_files : T . List [ File ] = [ ] for d in _deps : if isinstance ( d , File ) : depend_files . append ( d ) else : depends . append ( d ) inc_strs : T . List [ str ] = [ ] for i in kwargs [ 'include_directories' ] : # bindgen always uses clang, so it's safe to hardcode -I here inc_strs . extend ( [ f'-I{x}' for x in i . to_string_list ( state . environment . get_source_dir ( ) ) ] ) if self . _bindgen_bin is None : self . _bindgen_bin = state . find_program ( 'bindgen' ) name : str if isinstance ( header , File ) : name = header . fname elif isinstance ( header , ( BuildTarget , BothLibraries , ExtractedObjects ) ) : raise InterpreterException ( 'bindgen source file must be a C header, not an object or build target' ) else : name = header . get_outputs ( ) [ 0 ] target = CustomTarget ( f'rustmod-bindgen-{name}' . replace ( '/' , '_' ) , state . subdir , state . subproject , { 'input' : header , 'output' : kwargs [ 'output' ] , 'command' : self . _bindgen_bin . get_command ( ) + [ '@INPUT@' , '--output' , os . path . join ( state . environment . build_dir , '@OUTPUT@' ) ] + kwargs [ 'args' ] + [ '--' ] + kwargs [ 'c_args' ] + inc_strs + [ '-MD' , '-MQ' , '@INPUT@' , '-MF' , '@DEPFILE@' ] , 'depfile' : '@PLAINNAME@.d' , 'depends' : depends , 'depend_files' : depend_files , } , backend = state . backend , ) return ModuleReturnValue ( [ target ] , [ target ] )