spell error

This commit is contained in:
startewho 2023-09-08 15:37:29 +08:00
parent cee92d8130
commit c4781ee653
2 changed files with 5 additions and 5 deletions

View File

@ -172,7 +172,7 @@ csbindgen::Builder::default()
.csharp_use_function_pointer(true) // optional, default: true
.csharp_disable_emit_dll_name(false) // optional, default: false
.csharp_imported_namespaces("MyLib") // optional, default: empty
.csharp_generate_const_fliter (|_|false) // optional, default: `|_|false`
.csharp_generate_const_filter (|_|false) // optional, default: `|_|false`
.csharp_dll_name_if("UNITY_IOS && !UNITY_EDITOR", "__Internal") // optional, default: ""
.generate_csharp_file("../dotnet-sandbox/NativeMethods.cs") // required
.unwrap();
@ -196,7 +196,7 @@ namespace {csharp_namespace}
#endif
}
{csharp_generate_const_fliter}
{csharp_generate_const_filter}
[DllImport(__DllName, EntryPoint = "{csharp_entry_point_prefix}LZ4_versionNumber", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int {csharp_method_prefix}LZ4_versionNumber();
@ -207,7 +207,7 @@ namespace {csharp_namespace}
`csharp_disable_emit_dll_name` is optional, if set to true then don't emit `const string __DllName`. It is useful for generate same class-name from different builder.
`csharp_generate_const_fliter` is optional, if set a fliter fun, then generate fliter C# `const` field from Rust `const`.
`csharp_generate_const_filter` is optional, if set a fliter fun, then generate filter C# `const` field from Rust `const`.
`input_extern_file` and `input_bindgen_file` allow mulitple call, if you need to add dependent struct, use this.

View File

@ -251,12 +251,12 @@ fn collect_fields_unnamed(fields: &syn::FieldsUnnamed) -> Vec<FieldMember> {
result
}
pub fn collect_const(ast: &syn::File, result: &mut Vec<RustConst>,fliter:fn(const_name: &str) -> bool) {
pub fn collect_const(ast: &syn::File, result: &mut Vec<RustConst>,filter:fn(const_name: &str) -> bool) {
for item in depth_first_module_walk(&ast.items) {
if let Item::Const(ct) = item {
// pub const Ident: ty = expr
let const_name = ct.ident.to_string();
if fliter(const_name.as_str()) {
if filter(const_name.as_str()) {
let t = parse_type(&ct.ty);