1
2
3
/* automatically generated by rust-bindgen */

# [ doc = " A general purpose closure type defined in C code which can be created in Rust." ] # [ repr ( C ) ] # [ derive ( Debug ) ] pub struct Closure { # [ doc = " Directions to call the contained closure" ] pub function : :: std :: option :: Option < unsafe extern "C" fn ( data : * mut :: std :: os :: raw :: c_void , arg : * mut :: std :: os :: raw :: c_void ) -> * mut :: std :: os :: raw :: c_void > , # [ doc = " Rust user data for this closure." ] pub data : * mut :: std :: os :: raw :: c_void , # [ doc = " The data pointer may require personalized delete instructions, we can" ] # [ doc = " access those here." ] pub delete_data : :: std :: option :: Option < unsafe extern "C" fn ( data : * mut :: std :: os :: raw :: c_void ) > , # [ doc = " The value returned by this function may require personalized delete" ] # [ doc = " instructions, we can access those here." ] pub delete_ret : :: std :: option :: Option < unsafe extern "C" fn ( ret : * mut :: std :: os :: raw :: c_void ) > , } # [ test ] fn bindgen_test_layout_Closure ( ) { assert_eq ! ( :: std :: mem :: size_of :: < Closure > ( ) , 32usize , concat ! ( "Size of: " , stringify ! ( Closure ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < Closure > ( ) , 8usize , concat ! ( "Alignment of " , stringify ! ( Closure ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < Closure > ( ) ) ) . function as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( Closure ) , "::" , stringify ! ( function ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < Closure > ( ) ) ) . data as * const _ as usize } , 8usize , concat ! ( "Offset of field: " , stringify ! ( Closure ) , "::" , stringify ! ( data ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < Closure > ( ) ) ) . delete_data as * const _ as usize } , 16usize , concat ! ( "Offset of field: " , stringify ! ( Closure ) , "::" , stringify ! ( delete_data ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < Closure > ( ) ) ) . delete_ret as * const _ as usize } , 24usize , concat ! ( "Offset of field: " , stringify ! ( Closure ) , "::" , stringify ! ( delete_ret ) ) ) ; } extern "C" { # [ doc = " Calls the inner code. The return value of this may have come from" ] # [ doc = " Rust, meaning you can not free it. However it must be freed. When" ] # [ doc = " you're done with the return value, pass it back to Rust with" ] # [ doc = " `closure_release_return_value` so that the memory isn't leaked. If you won't be" ] # [ doc = " using the return value, instead call `closure_call_with_no_return`." ] pub fn closure_call ( self_ : * mut Closure , arg : * mut :: std :: os :: raw :: c_void ) -> * mut :: std :: os :: raw :: c_void ; } extern "C" { # [ doc = " Cleans up the value returned by calling this Closure. Do not attempt" ] # [ doc = " to free the returned pointer yourself." ] pub fn closure_release_return_value ( self_ : * mut Closure , ret : * mut :: std :: os :: raw :: c_void ) ; } extern "C" { # [ doc = " Calls the inner code and cleans up the returned value, if any." ] pub fn closure_call_with_no_return ( self_ : * mut Closure , arg : * mut :: std :: os :: raw :: c_void ) ; } extern "C" { # [ doc = " Release data associated with this closure, must be called when done with" ] # [ doc = " Closure to avoid memory leaking." ] pub fn closure_release ( self_ : * mut Closure ) ; }