pub fn write_annotation_generator(&mut self) -> String {
        let json = serde_json::to_string(&self.annotation).unwrap();
        let json = json.replace("\"", "\\\"");

        let split_type_info = self.annotation.params.iter().enumerate().map(|(i, param)| { 

            let (initializer, next) = match param.ty {
                SplitType::Named { .. } => {
                    (param.ty.splitter_init_func(), param.ty.splitter_next_func())
                },
                SplitType::Broadcast { .. } => ( "NULL".to_string(), "NULL".to_string() ),
                SplitType::Generic { .. } => unimplemented!("Generic split types are not implemented"),
            };

            // TODO: This probably won't work with generics...
            format!("SetSplitTypeInfo(s, {index}, (intptr_t){initializer}, (intptr_t){next}, sizeof({arg_type}));",
                index=i,
                initializer=initializer,
                next=next,
                arg_type=self.annotation.function.arguments[i].0
            )
        });
        let split_type_info = join("", "\n", split_type_info);

        format!(
            include_str!("resources/annotation.c.template"),
            function_name=self.annotation.function.func_name,
            annotation_json=json,
            set_split_type_info=split_type_info
        )
    }
/// Writes the function that sets up the annotation at runtime.
Writes the function that sets up the annotation at runtime.
Writes the function that sets up the annotation at runtime .
pub fn write_annotation_generator(&mut self) -> String {
        let json = serde_json::to_string(&self.annotation).unwrap();
        let json = json.replace("\"", "\\\"");
        let split_type_info = self.annotation.params.iter().enumerate().map(|(i, param)| { 
            let (initializer, next) = match param.ty {
                SplitType::Named { .. } => {
                    (param.ty.splitter_init_func(), param.ty.splitter_next_func())
                },
                SplitType::Broadcast { .. } => ( "NULL".to_string(), "NULL".to_string() ),
                SplitType::Generic { .. } => unimplemented!("Generic split types are not implemented"),
            };
            // TODO: This probably won't work with generics...
            format!("SetSplitTypeInfo(s, {index}, (intptr_t){initializer}, (intptr_t){next}, sizeof({arg_type}));",
                index=i,
                initializer=initializer,
                next=next,
                arg_type=self.annotation.function.arguments[i].0
            )
        });
        let split_type_info = join("", "\n", split_type_info);
        format!(
            include_str!("resources/annotation.c.template"),
            function_name=self.annotation.function.func_name,
            annotation_json=json,
            set_split_type_info=split_type_info
        )
    }
pub fn write_annotation_generator ( & mut self ) -> String { let json = serde_json :: to_string ( & self . annotation ) . unwrap ( ) ; let json = json . replace ( " \" " , " \\ \" " ) ; let split_type_info = self . annotation . params . iter ( ) . enumerate ( ) . map ( | ( i , param ) | { let ( initializer , next ) = match param . ty { SplitType :: Named { .. } => { ( param . ty . splitter_init_func ( ) , param . ty . splitter_next_func ( ) ) } , SplitType :: Broadcast { .. } => ( " " . to_string ( ) , " " . to_string ( ) ) , SplitType :: Generic { .. } => unimplemented ! ( " " ) , } ; // TODO: This probably won't work with generics... format ! ( " " index i initializer initializer next next arg_type self annotation function arguments [ i ] 0 ) } ) ; let split_type_info = join ( " " , " \n " , split_type_info ) ; format ! ( include_str ( " " ) function_name self annotation function func_name annotation_json json set_split_type_info split_type_info ) }
Writes the function that sets up the annotation at runtime.
Writes the function that sets up the annotation at runtime .
&mut self