// N.B: If the signature was required, it won't be wrapped in a Result<...> // and we can simply call it directly. let fn_ = if is_required {
quote! { self.#ident }
} else {
quote! { self.#ident.as_ref().expect("Expected function, got error.") }
}; let call_body = if ctx.options().wrap_unsafe_ops {
quote!(unsafe { (#fn_)(#(#args_identifiers ),*) })
} else {
quote!((#fn_)(#(#args_identifiers ),*) )
};
// We can't implement variadic functions from C easily, so we allow to // access the function pointer so that the user can call it just fine. if !is_variadic { self.struct_implementation.push(quote! { #(#attributes)* pubunsafefn#ident ( &self, #(#args ),* ) #ret_ty { #call_body
}
});
}
// N.B: Unwrap the signature upon construction if it is required to be resolved. let ident_str = codegen::helpers::ast_ty::cstr_expr(ident.to_string()); let library_get = if ctx.options().wrap_unsafe_ops {
quote!(unsafe { __library.get(#ident_str) })
} else {
quote!(__library.get(#ident_str))
};
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet am 2026-06-19)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.