pub struct FFIUtils;Expand description
Foreign Function Interface (FFI) utilities
Implementations§
Source§impl FFIUtils
impl FFIUtils
Sourcepub fn create_c_signature(
function_name: &str,
parameters: &[CParameter],
return_type: CType,
) -> String
pub fn create_c_signature( function_name: &str, parameters: &[CParameter], return_type: CType, ) -> String
Create C-compatible function signature
Sourcepub fn generate_c_header(
library_name: &str,
functions: &[CFunctionSignature],
) -> String
pub fn generate_c_header( library_name: &str, functions: &[CFunctionSignature], ) -> String
Generate C header file
Sourcepub fn rust_string_to_c(s: &str) -> UtilsResult<*mut c_char>
pub fn rust_string_to_c(s: &str) -> UtilsResult<*mut c_char>
Convert Rust string to C string
Sourcepub unsafe fn c_string_to_rust(ptr: *const c_char) -> UtilsResult<String>
pub unsafe fn c_string_to_rust(ptr: *const c_char) -> UtilsResult<String>
Convert C string to Rust string
§Safety
This function is unsafe because it dereferences a raw pointer. The caller must ensure:
- The pointer is valid and points to a null-terminated C string
- The pointer remains valid for the duration of this function call
- The memory pointed to by the pointer is not accessed by other threads during this call
Sourcepub fn create_array_transfer(data: &[f64]) -> ArrayTransfer
pub fn create_array_transfer(data: &[f64]) -> ArrayTransfer
Create array transfer structure for FFI
Sourcepub fn generate_ffi_examples() -> String
pub fn generate_ffi_examples() -> String
Generate FFI binding examples
Auto Trait Implementations§
impl Freeze for FFIUtils
impl RefUnwindSafe for FFIUtils
impl Send for FFIUtils
impl Sync for FFIUtils
impl Unpin for FFIUtils
impl UnwindSafe for FFIUtils
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more