Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- macro_rules! some_if{
- ($condition:expr,$some:expr) ==> {{
- match $condition{
- true => Some($some),
- _ => None,
- }
- }}
- }
- #[test]
- fn test_it_works(){
- let maybe= some_if!(true,"aha");
- match maybe{
- Ok(s)=> assert!(s.eq("aha")),
- _ => assert!(false,"uuh")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement