pub struct Builder { /* private fields */ }
Implementations§
Source§impl Builder
impl Builder
pub fn new() -> Self
Sourcepub fn input_bindgen_file<T: AsRef<Path>>(
self,
input_bindgen_file: T,
) -> Builder
pub fn input_bindgen_file<T: AsRef<Path>>( self, input_bindgen_file: T, ) -> Builder
Add an input .rs file(such as generated from bindgen) to generate binding.
Sourcepub fn input_extern_file<T: AsRef<Path>>(self, input_extern_file: T) -> Builder
pub fn input_extern_file<T: AsRef<Path>>(self, input_extern_file: T) -> Builder
Add an input .rs file for collect extern methods to C# binding.
Sourcepub fn method_filter(
self,
method_filter: fn(method_name: String) -> bool,
) -> Builder
pub fn method_filter( self, method_filter: fn(method_name: String) -> bool, ) -> Builder
Filter generate method callback, default is !x.starts_with('_')
Sourcepub fn always_included_types<I, S>(self, always_included_types: I) -> Builderwhere
I: IntoIterator<Item = S>,
S: ToString,
pub fn always_included_types<I, S>(self, always_included_types: I) -> Builderwhere
I: IntoIterator<Item = S>,
S: ToString,
Adds a list of types that will always be considered to be included in the generated bindings, even if not part of any function signature
Sourcepub fn rust_method_type_path<T: Into<String>>(
self,
rust_method_type_path: T,
) -> Builder
pub fn rust_method_type_path<T: Into<String>>( self, rust_method_type_path: T, ) -> Builder
add original extern call type prefix to rust wrapper,
return {rust_method_type_path}::foo()
Sourcepub fn rust_method_prefix<T: Into<String>>(
self,
rust_method_prefix: T,
) -> Builder
pub fn rust_method_prefix<T: Into<String>>( self, rust_method_prefix: T, ) -> Builder
add method prefix to rust wrapper, default is csbindgen_
pub extern "C" fn {rust_method_prefix}foo()
Sourcepub fn rust_file_header<T: Into<String>>(self, rust_file_header: T) -> Builder
pub fn rust_file_header<T: Into<String>>(self, rust_file_header: T) -> Builder
add file header string to rust wrapper,
mod lz4;
, use super::lz4;
Sourcepub fn csharp_namespace<T: Into<String>>(self, csharp_namespace: T) -> Builder
pub fn csharp_namespace<T: Into<String>>(self, csharp_namespace: T) -> Builder
configure C# file namespace(default is CsBindgen
),
“namespace {csharp_namespace}”
Sourcepub fn csharp_import_namespace<T: Into<String>>(
self,
csharp_namespace: T,
) -> Builder
pub fn csharp_import_namespace<T: Into<String>>( self, csharp_namespace: T, ) -> Builder
configure C# extra import namespace, “using {csharp_namespace};”
Sourcepub fn csharp_class_name<T: Into<String>>(self, csharp_class_name: T) -> Builder
pub fn csharp_class_name<T: Into<String>>(self, csharp_class_name: T) -> Builder
configure C# class name(default is NativeMethods
),
public static unsafe partial class {csharp_class_name}
Sourcepub fn csharp_dll_name<T: Into<String>>(self, csharp_dll_name: T) -> Builder
pub fn csharp_dll_name<T: Into<String>>(self, csharp_dll_name: T) -> Builder
configure C# load dll name,
[DllImport({csharp_dll_name})]
Sourcepub fn csharp_disable_emit_dll_name(
self,
csharp_disable_emit_dll_name: bool,
) -> Builder
pub fn csharp_disable_emit_dll_name( self, csharp_disable_emit_dll_name: bool, ) -> Builder
configure don’t emit __DllName
Sourcepub fn csharp_entry_point_prefix<T: Into<String>>(
self,
csharp_entry_point_prefix: T,
) -> Builder
pub fn csharp_entry_point_prefix<T: Into<String>>( self, csharp_entry_point_prefix: T, ) -> Builder
configure C# DllImport EntryPoint prefix,
[DllImport(, EntryPoint ="{csharp_entry_point_prefix}foo")]
Sourcepub fn csharp_method_prefix<T: Into<String>>(
self,
csharp_method_prefix: T,
) -> Builder
pub fn csharp_method_prefix<T: Into<String>>( self, csharp_method_prefix: T, ) -> Builder
configure C# calling method name prefix,
public static extern void {csharp_method_prefix}foo()
Sourcepub fn csharp_class_accessibility<T: Into<String>>(
self,
csharp_class_accessibility: T,
) -> Builder
pub fn csharp_class_accessibility<T: Into<String>>( self, csharp_class_accessibility: T, ) -> Builder
configure C# class accessibility, default is internal
{csharp_class_accessibility} static unsafe partial class NativeMethods
Sourcepub fn csharp_dll_name_if<T: Into<String>>(
self,
if_symbol: T,
if_dll_name: T,
) -> Builder
pub fn csharp_dll_name_if<T: Into<String>>( self, if_symbol: T, if_dll_name: T, ) -> Builder
configure add C# dll name if directive, #if {if_symbol} __DllName = {if_dll_name}
Sourcepub fn csharp_use_function_pointer(
self,
csharp_use_function_pointer: bool,
) -> Builder
pub fn csharp_use_function_pointer( self, csharp_use_function_pointer: bool, ) -> Builder
configure C# generate function pointer as delegate* or Func/Action, default is true(generate delegate*)
Sourcepub fn csharp_use_nint_types(self, csharp_use_nint_types: bool) -> Builder
pub fn csharp_use_nint_types(self, csharp_use_nint_types: bool) -> Builder
configure C# usage of nint
/nuint
in place of System.IntPtr
/System.UIntPtr
, default is true
(use nint
/nuint
)
Sourcepub fn csharp_generate_const(self, csharp_generate_const: bool) -> Builder
👎Deprecated: User csharp_generate_const_filter instead
pub fn csharp_generate_const(self, csharp_generate_const: bool) -> Builder
configure C# generate const, default is false equivalent to csharp_generate_const_filter(|_| csharp_generate_const)
Sourcepub fn csharp_generate_const_filter(
self,
csharp_generate_const_filter: fn(const_name: &str) -> bool,
) -> Builder
pub fn csharp_generate_const_filter( self, csharp_generate_const_filter: fn(const_name: &str) -> bool, ) -> Builder
configure C# generate const filter, default |_| false
Sourcepub fn csharp_type_rename(
self,
csharp_type_rename: fn(rust_type_name: String) -> String,
) -> Builder
pub fn csharp_type_rename( self, csharp_type_rename: fn(rust_type_name: String) -> String, ) -> Builder
configure the mappings that C# type name from rust original type name, default |x| x
Sourcepub fn csharp_file_header<T: Into<String>>(
self,
csharp_file_header: T,
) -> Builder
pub fn csharp_file_header<T: Into<String>>( self, csharp_file_header: T, ) -> Builder
configure the additional header for the generated C# code.
configure the additional footer for the generated C# code.