Trait RustGenerator

Source
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§