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

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

Required methods

pub fn usage_prim(&self, ty: &PrimType) -> Result<String>[src]

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

pub fn usage_var(&self, var: &str) -> Result<String>[src]

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

pub fn usage_func(&self, func: &FuncType) -> Result<String>[src]

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

pub fn usage_opt(&self, ty: &IDLType) -> Result<String>[src]

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

pub fn usage_vec(&self, ty: &IDLType) -> Result<String>[src]

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

pub fn usage_record(&self, fields: &[TypeField]) -> Result<String>[src]

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

pub fn usage_variant(&self, fields: &[TypeField]) -> Result<String>[src]

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

pub fn usage_service(&self, ty: &[Binding]) -> Result<String>[src]

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

pub fn declare_prim(&self, id: &str, ty: &PrimType) -> Result<String>[src]

Function called when declaring a primary type.

pub fn declare_var(&self, id: &str, var: &str) -> Result<String>[src]

Function called when declaring a var reference type.

pub fn declare_func(&self, id: &str, func: &FuncType) -> Result<String>[src]

Function called when declaring a function type.

pub fn declare_opt(&self, id: &str, ty: &IDLType) -> Result<String>[src]

Function called when declaring a optional type.

pub fn declare_vec(&self, id: &str, ty: &IDLType) -> Result<String>[src]

Function called when declaring a vector type.

pub fn declare_record(&self, id: &str, fields: &[TypeField]) -> Result<String>[src]

Function called when declaring a record type.

pub fn declare_variant(&self, id: &str, fields: &[TypeField]) -> Result<String>[src]

Function called when declaring a variant type.

pub fn declare_service(&self, id: &str, ty: &[Binding]) -> Result<String>[src]

Function called when declaring a service type.

pub fn service_binding(&self, id: &str, typ: &FuncType) -> Result<String>[src]

Function called when declaring a binding inside a service.

Loading content...

Provided methods

pub fn start(&self) -> Result<()>[src]

Called when the program starts to be analyzed.

pub fn done(&self, output: String) -> Result<String>[src]

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

pub fn header(&self) -> Result<String>[src]

The header string that will be prepended to the output.

pub fn footer(&self) -> Result<String>[src]

The footer string that will be appended to the output.

pub fn usage(&self, ty: &IDLType) -> Result<String>[src]

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.

pub fn declare(&self, id: &str, ty: &IDLType) -> Result<String>[src]

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.

pub fn declaration_import(&self, _module: &str) -> Result<String>[src]

Function called when an import statement is used.

pub fn declaration_binding(&self, binding: &Binding) -> Result<String>[src]

Function called when a declaration binding is used.

pub fn declarations(&self, declarations: &[Dec]) -> Result<String>[src]

Function called for all declarations in a Candid file.

pub fn service(&self, bindings: &[Binding]) -> Result<String>[src]

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.

pub fn prog(&self, prog: &IDLProg) -> Result<String>[src]

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

Loading content...

Implementors

Loading content...