pub trait RustGenerator {
Show 38 methods
fn push_str(&mut self, s: &str);
fn info(&self, ty: TypeId) -> TypeInfo;
fn types_mut(&mut self) -> &mut Types;
fn print_borrowed_slice(
&mut self,
iface: &Interface,
mutbl: bool,
ty: &Type,
lifetime: &'static str
);
fn print_borrowed_str(&mut self, lifetime: &'static str);
fn default_param_mode(&self) -> TypeMode;
fn handle_projection(&self) -> Option<(&'static str, String)>;
fn handle_wrapper(&self) -> Option<&'static str>;
fn handle_in_super(&self) -> bool { ... }
fn rustdoc(&mut self, docs: &Docs) { ... }
fn rustdoc_params(&mut self, docs: &[(String, Type)], header: &str) { ... }
fn print_signature(
&mut self,
iface: &Interface,
func: &Function,
param_mode: TypeMode,
sig: &FnSig
) -> Vec<String> { ... }
fn print_docs_and_params(
&mut self,
iface: &Interface,
func: &Function,
param_mode: TypeMode,
sig: &FnSig
) -> Vec<String> { ... }
fn print_ty(&mut self, iface: &Interface, ty: &Type, mode: TypeMode) { ... }
fn print_tyid(&mut self, iface: &Interface, id: TypeId, mode: TypeMode) { ... }
fn print_list(&mut self, iface: &Interface, ty: &Type, mode: TypeMode) { ... }
fn print_rust_slice(
&mut self,
iface: &Interface,
mutbl: bool,
ty: &Type,
lifetime: &'static str
) { ... }
fn print_generics(
&mut self,
info: &TypeInfo,
lifetime: Option<&str>,
bound: bool
) { ... }
fn int_repr(&mut self, repr: Int) { ... }
fn wasm_type(&mut self, ty: WasmType) { ... }
fn modes_of(
&self,
iface: &Interface,
ty: TypeId,
generate_struct_always: bool
) -> Vec<(String, TypeMode)> { ... }
fn write_name(&self, iface: &Interface, ty: &Type, out: &mut String) { ... }
fn union_case_names(&self, iface: &Interface, union: &Union) -> Vec<String> { ... }
fn print_typedef_record(
&mut self,
iface: &Interface,
id: TypeId,
record: &Record,
docs: &Docs,
generate_structs: bool
) { ... }
fn print_typedef_tuple(
&mut self,
iface: &Interface,
id: TypeId,
tuple: &Tuple,
docs: &Docs,
generate_structs: bool
) { ... }
fn print_typedef_variant(
&mut self,
iface: &Interface,
id: TypeId,
variant: &Variant,
docs: &Docs,
generate_structs: bool
)
where
Self: Sized,
{ ... }
fn print_typedef_union(
&mut self,
iface: &Interface,
id: TypeId,
union: &Union,
docs: &Docs,
generate_structs: bool
)
where
Self: Sized,
{ ... }
fn print_rust_enum<'a>(
&mut self,
iface: &Interface,
id: TypeId,
cases: impl IntoIterator<Item = (String, &'a Docs, &'a Type)> + Clone,
docs: &Docs,
generate_structs: bool
)
where
Self: Sized,
{ ... }
fn print_rust_enum_debug<'a>(
&mut self,
id: TypeId,
mode: TypeMode,
name: &str,
cases: impl IntoIterator<Item = (String, &'a Type)>
)
where
Self: Sized,
{ ... }
fn print_typedef_option(
&mut self,
iface: &Interface,
id: TypeId,
payload: &Type,
docs: &Docs,
generate_structs: bool
) { ... }
fn print_typedef_expected(
&mut self,
iface: &Interface,
id: TypeId,
expected: &Expected,
docs: &Docs,
generate_structs: bool
) { ... }
fn print_typedef_enum(
&mut self,
id: TypeId,
name: &str,
enum_: &Enum,
docs: &Docs,
generate_structs: bool
)
where
Self: Sized,
{ ... }
fn print_typedef_alias(
&mut self,
iface: &Interface,
id: TypeId,
ty: &Type,
docs: &Docs,
generate_structs: bool
) { ... }
fn print_type_list(
&mut self,
iface: &Interface,
id: TypeId,
ty: &Type,
docs: &Docs,
generate_structs: bool
) { ... }
fn param_name(&self, iface: &Interface, ty: TypeId) -> String { ... }
fn result_name(&self, iface: &Interface, ty: TypeId) -> String { ... }
fn uses_two_names(&self, info: &TypeInfo) -> bool { ... }
fn lifetime_for(
&self,
info: &TypeInfo,
mode: TypeMode
) -> Option<&'static str> { ... }
}
Required Methods
sourcefn print_borrowed_slice(
fn print_borrowed_slice(
&mut self,
iface: &Interface,
mutbl: bool,
ty: &Type,
lifetime: &'static str
)
source
fn print_borrowed_str(&mut self, lifetime: &'static str)
source
fn default_param_mode(&self) -> TypeMode
source
fn handle_projection(&self) -> Option<(&'static str, String)>
source
fn handle_wrapper(&self) -> Option<&'static str>
Provided Methods
source
fn handle_in_super(&self) -> bool
source
fn rustdoc_params(&mut self, docs: &[(String, Type)], header: &str)
sourcefn print_signature(
fn print_signature(
&mut self,
iface: &Interface,
func: &Function,
param_mode: TypeMode,
sig: &FnSig
) -> Vec<String>
sourcefn print_docs_and_params(
fn print_docs_and_params(
&mut self,
iface: &Interface,
func: &Function,
param_mode: TypeMode,
sig: &FnSig
) -> Vec<String>
source
fn print_tyid(&mut self, iface: &Interface, id: TypeId, mode: TypeMode)
source
fn print_list(&mut self, iface: &Interface, ty: &Type, mode: TypeMode)
sourcefn print_rust_slice(
fn print_rust_slice(
&mut self,
iface: &Interface,
mutbl: bool,
ty: &Type,
lifetime: &'static str
)
sourcefn modes_of(
fn modes_of(
&self,
iface: &Interface,
ty: TypeId,
generate_struct_always: bool
) -> Vec<(String, TypeMode)>
sourcefn write_name(&self, iface: &Interface, ty: &Type, out: &mut String)
fn write_name(&self, iface: &Interface, ty: &Type, out: &mut String)
Writes the camel-cased ‘name’ of the passed type to out
, as used to name union variants.
sourcefn union_case_names(&self, iface: &Interface, union: &Union) -> Vec<String>
fn union_case_names(&self, iface: &Interface, union: &Union) -> Vec<String>
Returns the names for the cases of the passed union.
sourcefn print_typedef_record(
fn print_typedef_record(
&mut self,
iface: &Interface,
id: TypeId,
record: &Record,
docs: &Docs,
generate_structs: bool
)
sourcefn print_typedef_tuple(
fn print_typedef_tuple(
&mut self,
iface: &Interface,
id: TypeId,
tuple: &Tuple,
docs: &Docs,
generate_structs: bool
)
sourcefn print_typedef_variant(
fn print_typedef_variant(
&mut self,
iface: &Interface,
id: TypeId,
variant: &Variant,
docs: &Docs,
generate_structs: bool
)where
Self: Sized,
sourcefn print_typedef_union(
fn print_typedef_union(
&mut self,
iface: &Interface,
id: TypeId,
union: &Union,
docs: &Docs,
generate_structs: bool
)where
Self: Sized,
sourcefn print_rust_enum<'a>(
fn print_rust_enum<'a>(
&mut self,
iface: &Interface,
id: TypeId,
cases: impl IntoIterator<Item = (String, &'a Docs, &'a Type)> + Clone,
docs: &Docs,
generate_structs: bool
)where
Self: Sized,
sourcefn print_rust_enum_debug<'a>(
fn print_rust_enum_debug<'a>(
&mut self,
id: TypeId,
mode: TypeMode,
name: &str,
cases: impl IntoIterator<Item = (String, &'a Type)>
)where
Self: Sized,
sourcefn print_typedef_option(
fn print_typedef_option(
&mut self,
iface: &Interface,
id: TypeId,
payload: &Type,
docs: &Docs,
generate_structs: bool
)
sourcefn print_typedef_expected(
fn print_typedef_expected(
&mut self,
iface: &Interface,
id: TypeId,
expected: &Expected,
docs: &Docs,
generate_structs: bool
)
sourcefn print_typedef_enum(
fn print_typedef_enum(
&mut self,
id: TypeId,
name: &str,
enum_: &Enum,
docs: &Docs,
generate_structs: bool
)where
Self: Sized,
sourcefn print_typedef_alias(
fn print_typedef_alias(
&mut self,
iface: &Interface,
id: TypeId,
ty: &Type,
docs: &Docs,
generate_structs: bool
)
sourcefn print_type_list(
fn print_type_list(
&mut self,
iface: &Interface,
id: TypeId,
ty: &Type,
docs: &Docs,
generate_structs: bool
)
source
fn param_name(&self, iface: &Interface, ty: TypeId) -> String
source
fn result_name(&self, iface: &Interface, ty: TypeId) -> String
source