Trait candid::codegen::LanguageBinding
source · [−]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
sourcefn usage_prim(&self, ty: &PrimType) -> Result<String>
fn usage_prim(&self, ty: &PrimType) -> Result<String>
String to use when using a primary type as a right hand side.
sourcefn usage_var(&self, var: &str) -> Result<String>
fn usage_var(&self, var: &str) -> Result<String>
String to use when using a var reference as a right hand side.
sourcefn usage_func(&self, func: &FuncType) -> Result<String>
fn usage_func(&self, func: &FuncType) -> Result<String>
String to use when using a function type as a right hand side.
sourcefn usage_opt(&self, ty: &IDLType) -> Result<String>
fn usage_opt(&self, ty: &IDLType) -> Result<String>
String to use when using an optional type as a right hand side.
sourcefn usage_vec(&self, ty: &IDLType) -> Result<String>
fn usage_vec(&self, ty: &IDLType) -> Result<String>
String to use when using a vector type as a right hand side.
sourcefn usage_record(&self, fields: &[TypeField]) -> Result<String>
fn usage_record(&self, fields: &[TypeField]) -> Result<String>
String to use when using a record type as a right hand side.
sourcefn usage_variant(&self, fields: &[TypeField]) -> Result<String>
fn usage_variant(&self, fields: &[TypeField]) -> Result<String>
String to use when using a variant type as a right hand side.
sourcefn usage_service(&self, ty: &[Binding]) -> Result<String>
fn usage_service(&self, ty: &[Binding]) -> Result<String>
String to use when using a service type as a right hand side.
sourcefn declare_prim(&self, id: &str, ty: &PrimType) -> Result<String>
fn declare_prim(&self, id: &str, ty: &PrimType) -> Result<String>
Function called when declaring a primary type.
sourcefn declare_var(&self, id: &str, var: &str) -> Result<String>
fn declare_var(&self, id: &str, var: &str) -> Result<String>
Function called when declaring a var reference type.
sourcefn declare_func(&self, id: &str, func: &FuncType) -> Result<String>
fn declare_func(&self, id: &str, func: &FuncType) -> Result<String>
Function called when declaring a function type.
sourcefn declare_opt(&self, id: &str, ty: &IDLType) -> Result<String>
fn declare_opt(&self, id: &str, ty: &IDLType) -> Result<String>
Function called when declaring a optional type.
sourcefn declare_vec(&self, id: &str, ty: &IDLType) -> Result<String>
fn declare_vec(&self, id: &str, ty: &IDLType) -> Result<String>
Function called when declaring a vector type.
sourcefn declare_record(&self, id: &str, fields: &[TypeField]) -> Result<String>
fn declare_record(&self, id: &str, fields: &[TypeField]) -> Result<String>
Function called when declaring a record type.
sourcefn declare_variant(&self, id: &str, fields: &[TypeField]) -> Result<String>
fn declare_variant(&self, id: &str, fields: &[TypeField]) -> Result<String>
Function called when declaring a variant type.
Provided Methods
sourcefn done(&self, output: String) -> Result<String>
fn done(&self, output: String) -> Result<String>
Called when the code generation is done, with the output intended. The return value of this function will be the actual string outputted.
The footer string that will be appended to the output.
sourcefn usage(&self, ty: &IDLType) -> Result<String>
fn usage(&self, ty: &IDLType) -> Result<String>
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.
sourcefn declare(&self, id: &str, ty: &IDLType) -> Result<String>
fn declare(&self, id: &str, ty: &IDLType) -> Result<String>
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.
sourcefn declaration_import(&self, _module: &str) -> Result<String>
fn declaration_import(&self, _module: &str) -> Result<String>
Function called when an import statement is used.
sourcefn declaration_binding(&self, binding: &Binding) -> Result<String>
fn declaration_binding(&self, binding: &Binding) -> Result<String>
Function called when a declaration binding is used.
sourcefn declarations(&self, declarations: &[Dec]) -> Result<String>
fn declarations(&self, declarations: &[Dec]) -> Result<String>
Function called for all declarations in a Candid file.