You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
523 B

  1. #[macro_export]
  2. macro_rules! return_if_none {
  3. ($value:expr) => {
  4. match $value {
  5. Some(value) => value,
  6. None => return,
  7. }
  8. };
  9. }
  10. #[macro_export]
  11. macro_rules! break_if_none {
  12. ($value:expr) => {
  13. match $value {
  14. Some(value) => value,
  15. None => break,
  16. }
  17. };
  18. }
  19. #[macro_export]
  20. macro_rules! continue_if_none {
  21. ($value:expr) => {
  22. match $value {
  23. Some(value) => value,
  24. None => continue,
  25. }
  26. };
  27. }