1 #[cfg(feature = "static_keys_test")] 2 mod tests { 3 use static_keys::{define_static_key_false, static_branch_unlikely}; 4 define_static_key_false!(MY_STATIC_KEY); 5 #[inline(always)] foo()6 fn foo() { 7 println!("Entering foo function"); 8 if static_branch_unlikely!(MY_STATIC_KEY) { 9 println!("A branch"); 10 } else { 11 println!("B branch"); 12 } 13 } 14 static_keys_test()15 pub(super) fn static_keys_test() { 16 foo(); 17 unsafe { 18 MY_STATIC_KEY.enable(); 19 } 20 foo(); 21 } 22 } 23 static_keys_init()24pub fn static_keys_init() { 25 static_keys::global_init(); 26 #[cfg(feature = "static_keys_test")] 27 tests::static_keys_test(); 28 } 29