pub trait RustGenerator<'a> {
Show 44 methods // Required methods fn resolve(&self) -> &'a Resolve; fn path_to_interface(&self, interface: InterfaceId) -> Option<String>; fn ownership(&self) -> Ownership; fn push_vec_name(&mut self); fn push_string_name(&mut self); fn is_exported_resource(&self, ty: TypeId) -> bool; fn mark_resource_owned(&mut self, resource: TypeId); 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, mutbl: bool, ty: &Type, lifetime: &'static str, mode: TypeMode ); fn print_borrowed_str(&mut self, lifetime: &'static str); // Provided methods fn std_feature(&self) -> bool { ... } fn use_raw_strings(&self) -> bool { ... } fn rustdoc(&mut self, docs: &Docs) { ... } fn rustdoc_params(&mut self, docs: &[(String, Type)], header: &str) { ... } fn print_signature( &mut self, func: &Function, param_mode: TypeMode, sig: &FnSig ) -> Vec<String> { ... } fn print_docs_and_params( &mut self, func: &Function, param_mode: TypeMode, sig: &FnSig ) -> Vec<String> { ... } fn print_results(&mut self, results: &Results, mode: TypeMode) { ... } fn print_ty(&mut self, ty: &Type, mode: TypeMode) { ... } fn print_optional_ty(&mut self, ty: Option<&Type>, mode: TypeMode) { ... } fn type_path(&self, id: TypeId, owned: bool) -> String { ... } fn type_path_with_name(&self, id: TypeId, name: String) -> String { ... } fn print_tyid(&mut self, id: TypeId, mode: TypeMode) { ... } fn print_list(&mut self, ty: &Type, mode: TypeMode) { ... } fn print_rust_slice( &mut self, mutbl: bool, ty: &Type, lifetime: &'static str, mode: TypeMode ) { ... } fn print_generics(&mut self, lifetime: Option<&str>) { ... } fn int_repr(&mut self, repr: Int) { ... } fn wasm_type(&mut self, ty: WasmType) { ... } fn modes_of(&self, ty: TypeId) -> Vec<(String, TypeMode)> { ... } fn print_typedef_record( &mut self, id: TypeId, record: &Record, docs: &Docs, derive_component: bool ) { ... } fn print_typedef_tuple(&mut self, id: TypeId, tuple: &Tuple, docs: &Docs) { ... } fn print_typedef_variant( &mut self, id: TypeId, variant: &Variant, docs: &Docs, derive_component: bool ) where Self: Sized { ... } fn print_rust_enum<'b>( &mut self, id: TypeId, cases: impl IntoIterator<Item = (String, Option<String>, &'b Docs, Option<&'b Type>)> + Clone, docs: &Docs, derive_component: Option<&str> ) where Self: Sized { ... } fn print_rust_enum_debug<'b>( &mut self, id: TypeId, mode: TypeMode, name: &str, cases: impl IntoIterator<Item = (String, Option<&'b Type>)> ) where Self: Sized { ... } fn print_typedef_option(&mut self, id: TypeId, payload: &Type, docs: &Docs) { ... } fn print_typedef_result( &mut self, id: TypeId, result: &Result_, docs: &Docs ) { ... } fn print_typedef_enum( &mut self, id: TypeId, name: &str, enum_: &Enum, docs: &Docs, attrs: &[String], case_attr: Box<dyn Fn(&EnumCase) -> String> ) where Self: Sized { ... } fn print_typedef_alias(&mut self, id: TypeId, ty: &Type, docs: &Docs) { ... } fn print_type_list(&mut self, id: TypeId, ty: &Type, docs: &Docs) { ... } fn param_name(&self, ty: TypeId) -> String { ... } fn result_name(&self, ty: TypeId) -> String { ... } fn uses_two_names(&self, info: &TypeInfo) -> bool { ... } fn lifetime_for( &self, info: &TypeInfo, mode: TypeMode ) -> Option<&'static str> { ... }
}

Required Methods§

source

fn resolve(&self) -> &'a Resolve

source

fn path_to_interface(&self, interface: InterfaceId) -> Option<String>

source

fn ownership(&self) -> Ownership

Whether to generate owning or borrowing type definitions.

source

fn push_vec_name(&mut self)

Pushes the name of the Vec type to use.

source

fn push_string_name(&mut self)

Pushes the name of the String type to use.

source

fn is_exported_resource(&self, ty: TypeId) -> bool

source

fn mark_resource_owned(&mut self, resource: TypeId)

source

fn push_str(&mut self, s: &str)

source

fn info(&self, ty: TypeId) -> TypeInfo

source

fn types_mut(&mut self) -> &mut Types

source

fn print_borrowed_slice( &mut self, mutbl: bool, ty: &Type, lifetime: &'static str, mode: TypeMode )

source

fn print_borrowed_str(&mut self, lifetime: &'static str)

Provided Methods§

source

fn std_feature(&self) -> bool

Return true iff the generator should qualify uses of std features with #[cfg(feature = "std")] in its output.

source

fn use_raw_strings(&self) -> bool

Return true iff the generator should use &[u8] instead of &str in bindings.

source

fn rustdoc(&mut self, docs: &Docs)

source

fn rustdoc_params(&mut self, docs: &[(String, Type)], header: &str)

source

fn print_signature( &mut self, func: &Function, param_mode: TypeMode, sig: &FnSig ) -> Vec<String>

source

fn print_docs_and_params( &mut self, func: &Function, param_mode: TypeMode, sig: &FnSig ) -> Vec<String>

source

fn print_results(&mut self, results: &Results, mode: TypeMode)

source

fn print_ty(&mut self, ty: &Type, mode: TypeMode)

source

fn print_optional_ty(&mut self, ty: Option<&Type>, mode: TypeMode)

source

fn type_path(&self, id: TypeId, owned: bool) -> String

source

fn type_path_with_name(&self, id: TypeId, name: String) -> String

source

fn print_tyid(&mut self, id: TypeId, mode: TypeMode)

source

fn print_list(&mut self, ty: &Type, mode: TypeMode)

source

fn print_rust_slice( &mut self, mutbl: bool, ty: &Type, lifetime: &'static str, mode: TypeMode )

source

fn print_generics(&mut self, lifetime: Option<&str>)

source

fn int_repr(&mut self, repr: Int)

source

fn wasm_type(&mut self, ty: WasmType)

source

fn modes_of(&self, ty: TypeId) -> Vec<(String, TypeMode)>

source

fn print_typedef_record( &mut self, id: TypeId, record: &Record, docs: &Docs, derive_component: bool )

source

fn print_typedef_tuple(&mut self, id: TypeId, tuple: &Tuple, docs: &Docs)

source

fn print_typedef_variant( &mut self, id: TypeId, variant: &Variant, docs: &Docs, derive_component: bool )where Self: Sized,

source

fn print_rust_enum<'b>( &mut self, id: TypeId, cases: impl IntoIterator<Item = (String, Option<String>, &'b Docs, Option<&'b Type>)> + Clone, docs: &Docs, derive_component: Option<&str> )where Self: Sized,

source

fn print_rust_enum_debug<'b>( &mut self, id: TypeId, mode: TypeMode, name: &str, cases: impl IntoIterator<Item = (String, Option<&'b Type>)> )where Self: Sized,

source

fn print_typedef_option(&mut self, id: TypeId, payload: &Type, docs: &Docs)

source

fn print_typedef_result(&mut self, id: TypeId, result: &Result_, docs: &Docs)

source

fn print_typedef_enum( &mut self, id: TypeId, name: &str, enum_: &Enum, docs: &Docs, attrs: &[String], case_attr: Box<dyn Fn(&EnumCase) -> String> )where Self: Sized,

source

fn print_typedef_alias(&mut self, id: TypeId, ty: &Type, docs: &Docs)

source

fn print_type_list(&mut self, id: TypeId, ty: &Type, docs: &Docs)

source

fn param_name(&self, ty: TypeId) -> String

source

fn result_name(&self, ty: TypeId) -> String

source

fn uses_two_names(&self, info: &TypeInfo) -> bool

source

fn lifetime_for(&self, info: &TypeInfo, mode: TypeMode) -> Option<&'static str>

Implementors§