Trait candid::codegen::LanguageBinding[][src]

pub trait LanguageBinding {
Show 28 methods fn usage_prim(&self, ty: &PrimType) -> Result<String>;
fn usage_var(&self, var: &str) -> Result<String>;
fn usage_func(&self, func: &FuncType) -> Result<String>;
fn usage_opt(&self, ty: &IDLType) -> Result<String>;
fn usage_vec(&self, ty: &IDLType) -> Result<String>;
fn usage_record(&self, fields: &[TypeField]) -> Result<String>;
fn usage_variant(&self, fields: &[TypeField]) -> Result<String>;
fn usage_service(&self, ty: &[Binding]) -> Result<String>;
fn declare_prim(&self, id: &str, ty: &PrimType) -> Result<String>;
fn declare_var(&self, id: &str, var: &str) -> Result<String>;
fn declare_func(&self, id: &str, func: &FuncType) -> Result<String>;
fn declare_opt(&self, id: &str, ty: &IDLType) -> Result<String>;
fn declare_vec(&self, id: &str, ty: &IDLType) -> Result<String>;
fn declare_record(&self, id: &str, fields: &[TypeField]) -> Result<String>;
fn declare_variant(&self, id: &str, fields: &[TypeField]) -> Result<String>;
fn declare_service(&self, id: &str, ty: &[Binding]) -> Result<String>;
fn service_binding(&self, id: &str, typ: &FuncType) -> Result<String>; fn start(&self) -> Result<()> { ... }
fn done(&self, output: String) -> Result<String> { ... }
fn header(&self) -> Result<String> { ... }
fn footer(&self) -> Result<String> { ... }
fn usage(&self, ty: &IDLType) -> Result<String> { ... }
fn declare(&self, id: &str, ty: &IDLType) -> Result<String> { ... }
fn declaration_import(&self, _module: &str) -> Result<String> { ... }
fn declaration_binding(&self, binding: &Binding) -> Result<String> { ... }
fn declarations(&self, declarations: &[Dec]) -> Result<String> { ... }
fn service(&self, bindings: &[Binding]) -> Result<String> { ... }
fn prog(&self, prog: &IDLProg) -> Result<String> { ... }
}

Required methods

String to use when using a primary type as a right hand side.

String to use when using a var reference as a right hand side.

String to use when using a function type as a right hand side.

String to use when using an optional type as a right hand side.

String to use when using a vector type as a right hand side.

String to use when using a record type as a right hand side.

String to use when using a variant type as a right hand side.

String to use when using a service type as a right hand side.

Function called when declaring a primary type.

Function called when declaring a var reference type.

Function called when declaring a function type.

Function called when declaring a optional type.

Function called when declaring a vector type.

Function called when declaring a record type.

Function called when declaring a variant type.

Function called when declaring a service type.

Function called when declaring a binding inside a service.

Provided methods

Called when the program starts to be analyzed.

Called when the code generation is done, with the output intended. The return value of this function will be the actual string outputted.

The header string that will be prepended to the output.

The footer string that will be appended to the output.

This method is called when a type is used as a right hand side. By default it forwards it to a specialized method for each type.

String to use when declaring a type. This receives the ID of the type, and the right hand side of the type itself. By default it forwards it to a specialized method for each type.

Function called when an import statement is used.

Function called when a declaration binding is used.

Function called for all declarations in a Candid file.

Function called when declaring the service (or actor) of a candid file. By default returns the result of calling service_binding on all bindings, and returning a string separated by \n.

The main function which is called when starting the code generation.

Implementors