MCPcopy Create free account
hub / github.com/arcjet/gravity / generate_instance

Method generate_instance

cmd/gravity/src/codegen/factory.rs:132–148  ·  view source on GitHub ↗

Generate the Instance struct, and methods.

(&self, tokens: &mut Tokens<Go>)

Source from the content-addressed store, hash-verified

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> {

Callers 1

format_intoMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected