1 extern crate libloading; 2 3 #[cfg(test)] assert_send<T: Send>()4fn assert_send<T: Send>() {} 5 #[cfg(test)] assert_sync<T: Sync>()6fn assert_sync<T: Sync>() {} 7 #[cfg(test)] assert_display<T: std::fmt::Display>()8fn assert_display<T: std::fmt::Display>() {} 9 10 #[test] check_error_send()11fn check_error_send() { 12 assert_send::<libloading::Error>(); 13 } 14 15 #[test] check_error_sync()16fn check_error_sync() { 17 assert_sync::<libloading::Error>(); 18 } 19 20 #[test] check_error_display()21fn check_error_display() { 22 assert_display::<libloading::Error>(); 23 } 24 25 #[test] check_library_send()26fn check_library_send() { 27 assert_send::<libloading::Library>(); 28 } 29 30 #[cfg(unix)] 31 #[test] check_unix_library_send()32fn check_unix_library_send() { 33 assert_send::<libloading::os::unix::Library>(); 34 } 35 36 #[cfg(windows)] 37 #[test] check_windows_library_send()38fn check_windows_library_send() { 39 assert_send::<libloading::os::windows::Library>(); 40 } 41 42 #[test] check_library_sync()43fn check_library_sync() { 44 assert_sync::<libloading::Library>(); 45 } 46 47 #[cfg(unix)] 48 #[test] check_unix_library_sync()49fn check_unix_library_sync() { 50 assert_sync::<libloading::os::unix::Library>(); 51 } 52 53 #[cfg(windows)] 54 #[test] check_windows_library_sync()55fn check_windows_library_sync() { 56 assert_sync::<libloading::os::windows::Library>(); 57 } 58 59 #[test] check_symbol_send()60fn check_symbol_send() { 61 assert_send::<libloading::Symbol<fn() -> ()>>(); 62 // assert_not_send::<libloading::Symbol<*const ()>>(); 63 } 64 65 #[cfg(unix)] 66 #[test] check_unix_symbol_send()67fn check_unix_symbol_send() { 68 assert_send::<libloading::os::unix::Symbol<fn() -> ()>>(); 69 // assert_not_send::<libloading::os::unix::Symbol<*const ()>>(); 70 } 71 72 #[cfg(windows)] 73 #[test] check_windows_symbol_send()74fn check_windows_symbol_send() { 75 assert_send::<libloading::os::windows::Symbol<fn() -> ()>>(); 76 } 77 78 #[test] check_symbol_sync()79fn check_symbol_sync() { 80 assert_sync::<libloading::Symbol<fn() -> ()>>(); 81 // assert_not_sync::<libloading::Symbol<*const ()>>(); 82 } 83 84 #[cfg(unix)] 85 #[test] check_unix_symbol_sync()86fn check_unix_symbol_sync() { 87 assert_sync::<libloading::os::unix::Symbol<fn() -> ()>>(); 88 // assert_not_sync::<libloading::os::unix::Symbol<*const ()>>(); 89 } 90 91 #[cfg(windows)] 92 #[test] check_windows_symbol_sync()93fn check_windows_symbol_sync() { 94 assert_sync::<libloading::os::windows::Symbol<fn() -> ()>>(); 95 // assert_not_sync::<libloading::os::windows::Symbol<*const ()>>(); 96 } 97