Skip to main content

Module test_utils

Module test_utils 

Source
Expand description

Test utilities.

Structs§

SendWrapper
Unsafe wrapper for passing non-Send types through mpsc channels. Use with caution!
UserData
User data wrapper.

Enums§

TestError
Dummy error type for testing that implements ErrorCode.

Functions§

call_0
Call a FFI function and block until its callback gets called. Use this if the callback accepts no arguments in addition to user_data and error_code.
call_0_with_custom
Call a FFI function and block until its callback gets called. Use this if the callback accepts no arguments in addition to user_data and error_code. This version of the function takes a UserData with custom inner data.
call_1
Call an FFI function and block until its callback gets called, then return the argument which were passed to that callback. Use this if the callback accepts one argument in addition to user_data and error_code.
call_2
Call a FFI function and block until its callback gets called, then return the argument which were passed to that callback. Use this if the callback accepts two arguments in addition to user_data and error_code.
call_1_with_custom
Call an FFI function and block until its callback gets called, then return the argument which were passed to that callback. Use this if the callback accepts one argument in addition to user_data and error_code. This version of the function takes a UserData with custom inner data.
call_2_with_custom
Call a FFI function and block until its callback gets called, then return the argument which were passed to that callback. Use this if the callback accepts two arguments in addition to user_data and error_code. This version of the function takes a UserData with custom inner data.
call_vec
Call a FFI function and block until its callback gets called, then copy the array argument which was passed to Vec<T> and return the result. Use this if the callback accepts *const T and usize (length) arguments in addition to user_data and error_code.
call_vec_u8
Call a FFI function and block until its callback gets called, then copy the byte array argument which was passed to Vec<u8> and return the result.
call_vec_u8_with_custom
Call a FFI function and block until its callback gets called, then copy the byte array argument which was passed to Vec<u8> and return the result. This version of the function takes a UserData with custom inner data. This version of the function takes a UserData with custom inner data.
call_vec_with_custom
Call a FFI function and block until its callback gets called, then copy the array argument which was passed to Vec<T> and return the result. Use this if the callback accepts *const T and usize (length) arguments in addition to user_data and error_code. This version of the function takes a UserData with custom inner data.
send_via_user_data
Send through a mpsc::Sender pointed to by the user data’s common pointer.
send_via_user_data_custom
Send through a mpsc::Sender pointed to by the user data’s custom pointer.
sender_as_user_data
Convert a mpsc::Sender<T> to a void ptr which is then stored in the UserData struct and passed to ffi functions.
user_data_as_void
Convert a UserData to a void pointer which can be passed to ffi functions.