pub fn begin_function(
        &mut self,
        return_type: spirv::Word,
        function_id: Option<spirv::Word>,
        control: spirv::FunctionControl,
        function_type: spirv::Word,
    ) -> BuildResult<spirv::Word> {
        if self.selected_function.is_some() {
            return Err(Error::NestedFunction);
        }

        let id = match function_id {
            Some(v) => v,
            None => self.id(),
        };

        let mut f = dr::Function::new();
        f.def = Some(dr::Instruction::new(
            spirv::Op::Function,
            Some(return_type),
            Some(id),
            vec![
                dr::Operand::FunctionControl(control),
                dr::Operand::IdRef(function_type),
            ],
        ));
        self.module.functions.push(f);
        self.selected_function = Some(self.module.functions.len() - 1);
        Ok(id)
    }
/// Begins building of a new function.
///
/// If `function_id` is `Some(val)`, then `val` will be used as the result
/// id of the function under construction; otherwise, an unused result id
/// will be automatically assigned.
Begins building of a new function.
Begins building of a new function .
pub fn begin_function(
        &mut self,
        return_type: spirv::Word,
        function_id: Option<spirv::Word>,
        control: spirv::FunctionControl,
        function_type: spirv::Word,
    ) -> BuildResult<spirv::Word> {
        if self.selected_function.is_some() {
            return Err(Error::NestedFunction);
        }
        let id = match function_id {
            Some(v) => v,
            None => self.id(),
        };
        let mut f = dr::Function::new();
        f.def = Some(dr::Instruction::new(
            spirv::Op::Function,
            Some(return_type),
            Some(id),
            vec![
                dr::Operand::FunctionControl(control),
                dr::Operand::IdRef(function_type),
            ],
        ));
        self.module.functions.push(f);
        self.selected_function = Some(self.module.functions.len() - 1);
        Ok(id)
    }
pub fn begin_function ( & mut self , return_type : spirv :: Word , function_id : Option < spirv :: Word > , control : spirv :: FunctionControl , function_type : spirv :: Word , ) -> BuildResult < spirv :: Word > { if self . selected_function . is_some ( ) { return Err ( Error :: NestedFunction ) ; } let id = match function_id { Some ( v ) => v , None => self . id ( ) , } ; let mut f = dr :: Function :: new ( ) ; f . def = Some ( dr :: Instruction :: new ( spirv :: Op :: Function , Some ( return_type ) , Some ( id ) , vec ! [ dr Operand FunctionControl ( control ) dr Operand IdRef ( function_type ) ] , ) ) ; self . module . functions . push ( f ) ; self . selected_function = Some ( self . module . functions . len ( ) - 1 ) ; Ok ( id ) }
Begins building of a new function.
Begins building of a new function .
&mut self
return_type
spirv::Word
function_id
Option<spirv::Word>
control
spirv::FunctionControl
function_type
spirv::Word
&mut self
return_type
spirv::Word
function_id
Option<spirv::Word>
control
spirv::FunctionControl
function_type
spirv::Word