MCPcopy Create free account
hub / github.com/RustCrypto/utils / unwrap_or_macro

Function unwrap_or_macro

ctutils/src/ct_option.rs:690–702  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

688
689 #[test]
690 fn unwrap_or_macro() {
691 // Don't actually use this! It's just a test function implemented in variable-time
692 #[allow(clippy::trivially_copy_pass_by_ref)]
693 const fn select_vartime(a: &u8, b: &u8, choice: Choice) -> u8 {
694 if choice.to_bool() { *b } else { *a }
695 }
696
697 assert_eq!(
698 unwrap_or!(NONE, OTHER.unwrap(), select_vartime),
699 OTHER.unwrap()
700 );
701 assert_eq!(unwrap_or!(SOME, OTHER.unwrap(), select_vartime), VALUE);
702 }
703
704 #[test]
705 fn ct_eq() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected