Generate the Instance struct, and methods.
(&self, tokens: &mut Tokens<Go>)
| 130 | |
| 131 | /// Generate the Instance struct, and methods. |
| 132 | fn generate_instance(&self, tokens: &mut Tokens<Go>) { |
| 133 | let instance_name = &self.config.analyzed_imports.instance_name; |
| 134 | quote_in! { *tokens => |
| 135 | type $instance_name struct { |
| 136 | module $WAZERO_API_MODULE |
| 137 | } |
| 138 | $['\n'] |
| 139 | func (i *$instance_name) Close(ctx $CONTEXT_CONTEXT) error { |
| 140 | if err := i.module.Close(ctx); err != nil { |
| 141 | return err |
| 142 | } |
| 143 | |
| 144 | return nil |
| 145 | } |
| 146 | $['\n'] |
| 147 | }; |
| 148 | } |
| 149 | |
| 150 | /// Build parameter list for factory constructor |
| 151 | fn build_parameters(&self) -> Tokens<Go> { |